@@ -4,14 +4,14 @@ Feature: HTTP Errors
44 HTTP errors plugin reports network request failures, including those made using fetch, and xml http requests.
55
66 @requires_fetch
7- Scenario : Fetch request
7+ Scenario : Fetch Request - GET
88 When I navigate to the test URL "/http_errors?request=fetch"
99 And I wait to receive an error
1010 Then the error is a valid browser payload for the error reporting API
1111
1212 And I define "expected.context" as "GET <browser.hostname>"
13- And I define "expected.exception.message" as "404 : <browser.url>/reflect?status=404 &userId=[REDACTED]"
14- And I define "expected.request.url" as "<browser.url>/reflect?status=404 &userId=[REDACTED]"
13+ And I define "expected.exception.message" as "401 : <browser.url>/reflect?status=401 &userId=[REDACTED]"
14+ And I define "expected.request.url" as "<browser.url>/reflect?status=401 &userId=[REDACTED]"
1515
1616 And the exception "errorClass" equals "HTTPError"
1717 And the error payload field "events.0.exceptions.0.message" equals the stored value "expected.exception.message"
@@ -22,20 +22,52 @@ Feature: HTTP Errors
2222
2323 And the error payload field "events.0.request.url" equals the stored value "expected.request.url"
2424 And the event "request.httpMethod" equals "GET"
25- And the event "request.params.status" equals "404 "
25+ And the event "request.params.status" equals "401 "
2626 And the event "request.params.userId" equals "[REDACTED]"
2727 And the event "request.headers.x-token" equals "[REDACTED]"
28- And the event "request.body" equals ""
29- And the event "request.bodyLength" equals 0
28+ And the event "request.body" is null
29+ And the event "request.bodyLength" is null
3030
31- And the event "response.statusCode" equals 404
31+ And the event "response.statusCode" equals 401
3232 And the event "response.headers.content-length" equals "37"
33+
34+ # Response body is not captured for fetch requests
35+ And the event "response.body" is null
36+ And the event "response.bodyLength" is null
37+
38+ Scenario : Fetch Request - POST
39+ When I navigate to the test URL "/http_errors?request=fetch-post"
40+ And I wait to receive an error
41+ Then the error is a valid browser payload for the error reporting API
42+
43+ And I define "expected.context" as "POST <browser.hostname>"
44+ And I define "expected.exception.message" as "408: <browser.url>/reflect?status=408&userId=[REDACTED]"
45+ And I define "expected.request.url" as "<browser.url>/reflect?status=408&userId=[REDACTED]"
46+
47+ And the exception "errorClass" equals "HTTPError"
48+ And the error payload field "events.0.exceptions.0.message" equals the stored value "expected.exception.message"
49+ And the event "severity" equals "error"
50+ And the event "unhandled" is true
51+ And the event "severityReason.type" equals "httpError"
52+ And the error payload field "events.0.context" equals the stored value "expected.context"
53+
54+ And the error payload field "events.0.request.url" equals the stored value "expected.request.url"
55+ And the event "request.httpMethod" equals "POST"
56+ And the event "request.params.status" equals "408"
57+ And the event "request.params.userId" equals "[REDACTED]"
58+ And the event "request.headers.x-token" equals "[REDACTED]"
59+ And the event "request.body" equals "this is the request body"
60+ And the event "request.bodyLength" equals 24
61+
62+ And the event "response.statusCode" equals 408
63+ And the event "response.headers.content-length" equals "37"
64+
3365 # Response body is not captured for fetch requests
3466 And the event "response.body" is null
3567 And the event "response.bodyLength" is null
3668
3769 @requires_xml_http_request
38- Scenario : XML HTTP Request
70+ Scenario : XHR - GET
3971 When I navigate to the test URL "/http_errors?request=xhr"
4072 And I wait to receive an error
4173 Then the error is a valid browser payload for the error reporting API
@@ -56,10 +88,40 @@ Feature: HTTP Errors
5688 And the event "request.headers.X-Token" equals "[REDACTED]"
5789 And the event "request.params.status" equals "404"
5890 And the event "request.params.userId" equals "[REDACTED]"
59- And the event "request.body" equals ""
60- And the event "request.bodyLength" equals 0
91+ And the event "request.body" is null
92+ And the event "request.bodyLength" is null
6193
6294 And the event "response.statusCode" equals 404
6395 And the event "response.headers.content-length" equals "37"
6496 And the event "response.body" equals "Returned status 404 after waiting ms"
65- And the event "response.bodyLength" equals 37
97+ And the event "response.bodyLength" equals 37
98+
99+ @requires_xml_http_request
100+ Scenario : XHR - POST
101+ When I navigate to the test URL "/http_errors?request=xhr-post"
102+ And I wait to receive an error
103+ Then the error is a valid browser payload for the error reporting API
104+
105+ And I define "expected.context" as "POST <browser.hostname>"
106+ And I define "expected.exception.message" as "403: <browser.url>/reflect?status=403&userId=[REDACTED]"
107+ And I define "expected.request.url" as "<browser.url>/reflect?status=403&userId=[REDACTED]"
108+
109+ And the exception "errorClass" equals "HTTPError"
110+ And the error payload field "events.0.exceptions.0.message" equals the stored value "expected.exception.message"
111+ And the event "severity" equals "error"
112+ And the event "unhandled" is true
113+ And the event "severityReason.type" equals "httpError"
114+ And the error payload field "events.0.context" equals the stored value "expected.context"
115+
116+ And the error payload field "events.0.request.url" equals the stored value "expected.request.url"
117+ And the event "request.httpMethod" equals "POST"
118+ And the event "request.headers.X-Token" equals "[REDACTED]"
119+ And the event "request.params.status" equals "403"
120+ And the event "request.params.userId" equals "[REDACTED]"
121+ And the event "request.body" equals "this is the request body"
122+ And the event "request.bodyLength" equals 24
123+
124+ And the event "response.statusCode" equals 403
125+ And the event "response.headers.content-length" equals "37"
126+ And the event "response.body" equals "Returned status 403 after waiting ms"
127+ And the event "response.bodyLength" equals 37
0 commit comments