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: Incorrect statusCode: 201 #98

Closed
withtk opened this issue Apr 16, 2020 · 2 comments
Closed

Error: Incorrect statusCode: 201 #98

withtk opened this issue Apr 16, 2020 · 2 comments

Comments

@withtk
Copy link

withtk commented Apr 16, 2020

const bentData = bent(myUrl, 'POST', 'json', 200);
const response = await bentData(myKey, myData);
return response;

Error: Incorrect statusCode: 201

I got this error log sometimes.
But, the myData is uploaded completely.
why do I see this error..?

@mikeal
Copy link
Owner

mikeal commented Apr 16, 2020

The http server is returning the correct response code for a successful upload, a 201, but you’ve told bent to expect a 200 ;)

Change to bent(myURl, ‘POST’, ‘json’, 201) and it should work fine.

@mikeal mikeal closed this as completed Apr 16, 2020
@withtk
Copy link
Author

withtk commented Apr 17, 2020

The http server is returning the correct response code for a successful upload, a 201, but you’ve told bent to expect a 200 ;)

Change to bent(myURl, ‘POST’, ‘json’, 201) and it should work fine.

I fixed it like this.

const bentData = bent(esUrl, esMethod, 'json', 200, 201)

it works well.
Thank you so much for quick answering. ^^

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

2 participants