Forum Discussion

npasschyn's avatar
npasschyn
Visitor
4 years ago

Swagger compliance assertion with content type different than application/json always fails

The swagger compliance assertion has a too strict validation on the content type. Currently only the content type application/xml and application/json are allowed, otherwise the swagger compliance as...
  • richie's avatar
    4 years ago

    Hey npasschyn 

     

    Just so I understand - so you're swagger/OAS has mediatypes that include the +json suffix, but the Compliance Assertion isn't supporting requests with extended Content-Type header values?  Is that right?

     

    You can raise a Customer Support ticket to see if SmartBear can help and a New Feature request to include extended mediatype assertions -if it gets enough upvotes it could be considered for future ReadyAPI releases,

     

    The following link --> https://swagger.io/docs/specification/media-types/. indicates the supported extended media types supported by OAS currently and even explicitly mentions RFC 6368 (which is the RFC relating to vendor extensions which you appear to have in your payload) so you'd hope the Compliance Assertion would support them.

     

    However - there still might be a way to sort - at least we should be able to update your headers using an Event Handler at least. 

     

    You mentioned you tried using an event handler but it didn't work. 

     

    Can you confirm exactly what happened - what you mean by it didn't work?  Did you get errors?  No visible change?  What did it say in the ReadyAPI Log and the Error Log?

     

    Can you supply the code you used to attempt to change the header value please?

     

    Did you use RequestFilter.afterRequest or RequestFilter.filterRequest

     

    Cheers,

     

    Rich