artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
8.03k stars 510 forks source link

artillery-plugin-expect does not support application/problem+json #1114

Closed elton-okawa closed 3 years ago

elton-okawa commented 3 years ago

Greetings everyone 👋

Description

There is a standardized content type called application/problem+json to describe any error thrown by an API, basically it still returns a json if an error occurred.

Because it's still a json, I'd be nice to handle it the same way as application/json, parsing its body to an object allowing us to use existent assertions.

More info:

Example

API response

Content-type: application/problem+json

{
  "type": "https://example.com/pets/1",
  "title": "Pet not found",
  "detail": "Pet with id '1' not found",
  "status": 404,
}

Expectations:

- get:
     url: "/pets/1"
     expect:
       status: 404
       contentType: json
       hasProperty: type

After discussion and approval, I'd like to implement it 😄

elton-okawa commented 3 years ago

Solved by artillery-plugin-expect #24