ethanresnick / json-api-example

An example API created with my JSON-API library (http://github.com/ethanresnick/json-api)
31 stars 15 forks source link

When using POST or PUT it hangs #3

Closed adriaandotcom closed 8 years ago

adriaandotcom commented 9 years ago

What were you doing?

  1. POST http://localhost:3000/schools with this data

    {
     "data": {
     "type": "schools",
       "attributes": {
         "name": "Prins Maurits"
       }
     }
    }
  2. It returns the data for this entry
  3. PATCH or PUT http://localhost:3000/schools/5590fc64a2882d6aee102167 with this data

    {
     "data": {
       "type": "schools",
       "id": "5590fc64a2882d6aee102167",
       "attributes": {
         "description": "Not the best school"
       }
     }
    }

What did you expect to happen? Some error message saying, you are using the wrong request type.

What happened instead? There was no response

image

ethanresnick commented 9 years ago

PUT hanging is the result of a small bug in the underlying JSON API library. I'll fix that in the next release. Once that's done, the Example app will return 404 to PUT requests (though your app could return whatever you want, since the underlying json-api library will just ignore the request—JSON API defines no semantics for PUT—and pass it through to Express).

PATCH should most certainly work and does on my machine. If you're still having an issue with that, please provide more info about the request you're making (i.e. all the headers and the response you're getting back).

ethanresnick commented 8 years ago

The PUT is now (and long has been) correctly 404'ing, and I still can't reproduce the PATCH issue, so I'm going to give this a close. Let me know if you're still having this problem!

adriaandotcom commented 8 years ago

I will reopen this issue if the problem returns. Thanks for looking into it!