How can I specify multiple request types per endpoint in API Blueprint?

StackOverflow https://stackoverflow.com/questions/21687636

  •  09-10-2022
  •  | 
  •  

سؤال

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" }.

هل كانت مفيدة؟

المحلول

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
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top