question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting 400 Bad Request despite supplying required parameters

See original GitHub issue

Hi, I just discovered this package and am trying to use it without much success:

My short script:

const NBA = require('nba');

NBA.stats.scoreboard({GameDate: '03/19/2017'}).then((data) => {
  console.log('data = ' + JSON.stringify(data));
}).catch((err) => {
  console.log('Error: ' + err);
});

Produces the following error:

$ npm start

> nba-test@1.0.0 start c:\Users\Quasar\Desktop\nba-test
> node index.js

Error: Error: 400 Bad Request - GameDate is required

I looked in the tests and made sure that I was inputting the GameDate parameter correctly, and am still receiving this error. Please help!

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bttmlycommented, Mar 21, 2017

Well, the issue is that the NBA.stats namespace methods are generated dynamically from a JSON template. I’d like to keep this a thin-as-possible wrapper over the bare HTTP API – which is exactly why I dropped translating request parameters from javascriptStyle to NbaStyle.

1reaction
bttmlycommented, Mar 20, 2017

Change GameDate (capitalized first character) to gameDate (lowercase first character) and it should work. Nearly all the parameters have a capitalized first letter but gameDate is an exception. There is a note next to the test case for stats.scoreboard pointing this out: https://github.com/nickb1080/nba/blob/master/test/integration/stats.js#L59

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a 400 Bad Request Error (Causes and Fixes) - Kinsta
The 400 Bad Request error indicates that the server cannot or process the request due to a client error. Read about the common...
Read more >
400 BAD request HTTP error code meaning? - Stack Overflow
A 400 means that the request was malformed. In other words, the data stream sent by the client to the server didn't follow...
Read more >
400 Bad Request when creating new contact from form
Solved: I am receiving a 400 bad request when I attempt to submit a HttpClient.PostAsJsonAsync() from my asp.NET MVC web application. I have...
Read more >
How to Fix a 400 Bad Request Error: 8 Easy Methods
Most HTTP error 400 bad requests are caused by malformed request syntax, invalid request message framing, or deceptive request routing.
Read more >
400 Bad request - Just getting started - Postman community
The 400 (Bad Request) status code indicates that the server cannot or will not process the request because the received syntax is invalid, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found