API Testing Challenge 22 - How To - Post todos 415 status unsupported content type

API Testing Challenge 22 - How To - Post todos 415 status unsupported content type


API Testing Challenge 22 - How To - Post todos 415 status unsupported content type

How to complete the challenge POST /todos (415) to send a POST request to try and create a todo item but with unsupported content type.

Issue a POST request on the /todos end point with an unsupported content type to generate a 415 status code

For this challenge we issue a request with a content-type which is unsupported.

- POST request means we will send information in the body of the message
- e.g. POST /todos sends to the todos endpoint
- unsupported content type means that we will set content-type to something unknown eg. bob
- add the X-CHALLENGER header to track progress
- we know it has been rejected when we receive a 415 response
- the body of the response should contain the full details of the error message

For a write up of this solution, check out the blog post:

https://eviltester.com/apichallenges/

Find the API Challenges here:

https://eviltester.com/apichallenges

---

Remember to subscribe to this YouTube channel.

You can support me on Patreon https://patreon.com/eviltester (watch my videos ad free and receive extra content)

I blog at https://eviltester.com/blog

Learn more about my books and online training at:

- https://eviltester.com

Follow me on:

- https://twitter.com/eviltester
- https://instagram.com/eviltester
- https://facebook.com/eviltester


Content

0.96 -> okay so i'm working through the
3.439 -> api challenges at api challenges.heroku
6.56 -> app.com
7.759 -> and my next challenge is to post to the
10.48 -> to-do's
11.92 -> with an unsupported content type so
16.4 -> i have in here an existing post request
19.439 -> that we've issued before where i'm
20.88 -> accepting json
22.24 -> and supplying in json and there's the
25.84 -> json format there so if i just change
28.16 -> this to bob
30.72 -> what happens so it's in json format but
34.48 -> i'm
35.52 -> overriding that and saying that the
36.8 -> content type is application bob and send
39.44 -> that
40.399 -> and we get 415 unsupported media type
43.92 -> because it
44.399 -> it doesn't handle application slash bob
47.039 -> type for some reason
48.239 -> don't know why so that now because we
51.12 -> passed it through with the
52.719 -> x challenger header and the content type
55.039 -> that's not supported
56.239 -> should have passed the challenge so
58.32 -> issuing a post request within valid
60 -> content type
61.199 -> passes that particular challenge if you
64.32 -> want to work through the challenges
65.6 -> yourself you can find all the
66.96 -> information you need at
68.52 -> eviltester.com slash api challenges
72.24 -> make sure you subscribe to the youtube
74.64 -> channel
75.28 -> so that you're kept up to date with any
76.96 -> of the videos we're at least showing api
78.72 -> challenges or apis in general or
80.88 -> testing in general we have a lot of
82.64 -> content here subscribe to the channel
84.799 -> and hopefully i'll see you in the next
86 -> video

Source: https://www.youtube.com/watch?v=L8H-vkbXyr0