Collect non 200 responses
See original GitHub issueHello,
I’m not sure if this is currently possible, but if it is, please instruct me how. I want to see what uris failed with which statusCode, which for me is basically any status different from 200.
I’m currently trying with this:
module.exports.logErrors = function logArtilleryErrors(requestParams, response, context, ee, next) {
if (response.statusCode !== 200) {
ee.emit('nonOkResponse', {uri: requestParams.uri, statusCode: response.statusCode})
}
next();
}
But nothing appears on the log. What I’m doing wrong?
Regards
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to fix URLs with canonical to non-200 - Sitechecker
Canonical to non-200 issue means that URL contain a canonical link element where the canonical URL returned a server response other than 200...
Read more >HTTP response status codes - MDN Web Docs - Mozilla
Successful responses ( 200 – 299 ); Redirection messages ( 300 – 399 ); Client error responses ( 400 – 499 ); Server...
Read more >Empty list, HTTP status code 200 vs 204 vs 404 - API Handyman
While 200 OK being a valid and the most common answer, returning a 204 No Content could make sense as there is absolutely...
Read more >Create request with POST, which response codes 200 or 201 ...
The 201 (Created) status code indicates that the request has been fulfilled and has resulted in one or more new resources being created....
Read more >HTTP Status Codes: All 63 explained - including FAQ & Video
In some cases a HTTP response code might be descriptive enough to understand its meaning. 200 OK probably means that everything went okay....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey you can save the error log record in csv file format as well Step 1: Just install : npm i csv-writer
Step 2 : go to node_modules/artillery_plugin_expect/index.js file and add the below code in function(expectationsPluginCheckExpectations)
Changes in function
requestExpectations.results.forEach((e) => { if (e.ok) { events.emit(‘counter’,
plugins.expect.ok
, 1); events.emit(‘counter’,plugins.expect.ok.${e.type}
, 1); } else { events.emit(‘counter’,plugins.expect.failed
, 1); events.emit(‘counter’,plugins.expect.failed.${e.type}
, 1);});
// end here
Step 3 : **And Then create function saveConsoleLogResult and add the below code **
@paraspatidar there’s nothing special about how Artillery sends its traffic, so using Wireshark as normal should just work. It would be good to have an example blog post perhaps, but having it as part of the documentation would be out-of-scope for that reason.