3

Is it possible to define what happens when PUT to /asdf with an empty request body happens vs PUT to /asdf with this request body with { "value": "somthing" }.

Jinyoung Kim
  • 2,171
  • 20
  • 32

1 Answers1

3

Assuming the media type of both requests is the same and the response HTTP status codes differs this should be legit:

# PUT /asdf
+ Request Empty (application/json)
    + Headers

            Content-Lenght: 0

+ Response 400

+ Request With Value (application/json)

        { "value": "somthing" }

+ Response 204
Zdenek
  • 3,653
  • 27
  • 34
  • Note the first `Request Empty` currently yields a parser warning. I have made an issue for this problem here https://github.com/apiaryio/snowcrash/issues/77. Please refer to http://stackoverflow.com/a/1233569/634940 for details on PUT and empty body – Zdenek Feb 10 '14 at 22:16
  • In 4.3.1.4.3. Action Request Section, 4.3.1.4.4. Action Response Section is says "exactly one HTTP request/response" then later it says one or more different (that is with different HTTP Status codes). That's confusing. – Jinyoung Kim Feb 12 '14 at 21:12
  • On top of that, I actually was hoping to define who different descriptions both Response 204, one of a request with an empty request body and one with input. – Jinyoung Kim Feb 12 '14 at 21:13
  • 1
    @JinyoungKim good point on 4.3.1.4.3. I am currently re-structuring the specification as part of https://github.com/apiaryio/api-blueprint/issues/59 so I will make sure this get addressed – Zdenek Feb 13 '14 at 08:34
  • In my answer I was commenting on the current situation. For the future it is planned to allow multiple transaction examples (e.g. same response statuses) as a part of the testing support (https://github.com/apiaryio/api-blueprint/issues/21) – Zdenek Feb 13 '14 at 08:35