Skip to content

HTTP Accept header only accepts singular value #4358

@quick-pawiromitchel

Description

@quick-pawiromitchel

Description

The axios library passes multiple Accept Header values like so

curl -H 'Accept: application/json, text/plain, */*' -H 'User-Agent: axios/0.27.2' -H 'Connection: close' IP:PORT

This results in

{
  "code": 400,
  "message": "BAD_REQUEST: Unsupported endpoint version: v2",
  "stacktraces": []
}

Replacing the Accept header with a single value like application/json, the call will work as intended.
A similar issue is found here #3114

Version

Lighthouse v4.1.0-693886b

Steps to resolve

By overriding the Accept header, the call will go through successfully

const axios = require('axios');

axios.get('http://IP:PORT/eth/v2/beacon/blocks/finalized', {
    headers: {
        'Accept': '*/*'
    }
})
    .then(data => {
        console.log('Data:', data);
    })
    .catch(error => {
        console.error('There was a problem with the fetch operation:', error);
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions