Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error message for bad headers format is unclear #2129

Closed
aghArdeshir opened this issue May 5, 2019 · 1 comment
Closed

error message for bad headers format is unclear #2129

aghArdeshir opened this issue May 5, 2019 · 1 comment

Comments

@aghArdeshir
Copy link

Describe the bug

I was writing bad code. in my GET request, for config I was giving a string to it.
it made me look a lot for problem and double-check my variables
The only error I was given was name.toUpperCase is not a function

To Reproduce

return axios.post(
      `/api/bind_client`,
      { panel_id: panelId, client_ids: [clientId] },
      {
        headers:  Authorization: authService.getAuthToken() 
      }
    );

This is wrong 👆
And this is the right format I should have used:

return axios.post(
      `/api/bind_client`,
      { panel_id: panelId, client_ids: [clientId] },
      {
        headers: { Authorization: authService.getAuthToken() }
      }
    );

Expected behavior

I expected it to just tell me headers cant be strings, or headers must be an object, etc...

Environment:

  • Axios Version [e.g. 0.18.0] 0.18.0
  • OS: [e.g. iOS 12.1.0, OSX 10.13.4] Windows 10
  • Browser [e.g. Chrome, Safari] FireFox
  • Browser Version [e.g. 22] 66.0.3 (64-bit)
  • Additional Library Versions [e.g. React 16.7, React Native 0.58.0] React 16.8.6

Additional context/Screenshots
image

@jasonsaayman
Copy link
Member

See #4209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants