3 category: JavaScript libraries
5 prism_languages: [javascript]
13 // The HTTP Status Code (see: httpstatuses.com for definitions on HTTP status codes)
15 // True when res.status is 2xx
17 // True when res.status is 4xx or 5xx
19 // True when res.status is 4xx
21 // True when res.status is 5xx
24 // True when res.status == 202
26 // True when res.status == 204 || res.status == 1223
28 // True when res.status == 400
30 // True when res.status == 401
32 // True when res.status == 406
34 // True when res.status == 404
36 // True when res.status == 403
39 // Unparsed response text
40 text: '{"user":{"username":"JohnDoe","role":"admin"}}'
42 // Parsed response text (only if response is 'application/json' or 'application/x-www-form-urlencoded'
44 // Example of parsed object from res.text
51 // The content-type (parsed from headers)
52 type: 'application/json'
53 // The charset (parsed from headers)
55 // Header object with each header field as a property
57 'content-type': 'application/json; charset=UTF-8',