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

Response from POST does not match documentation: userId is string instead of integer #142

Open
BrennanAyers opened this issue Aug 11, 2020 · 0 comments

Comments

@BrennanAyers
Copy link

Steps to reproduce:

fetch('https://jsonplaceholder.typicode.com/posts', {
    method: 'POST',
    body: JSON.stringify({
      title: 'foo',
      body: 'bar',
      userId: 1
    }),
    headers: {
      "Content-type": "application/json; charset=UTF-8"
    }
  })
  .then(response => response.json())
  .then(json => console.log(json))

Expected response:

{
  id: 101,
  title: 'foo',
  body: 'bar',
  userId: 1
}

Actual response:

{
  id: 101,
  title: 'foo',
  body: 'bar',
  userId: '1'
}

I'm not sure which one is correct, but it did make writing tests against it a little confusing 😄

Thanks for maintaining the project, and I'm glad I could help in some way!

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

1 participant