newman: Unexpected end of file at request
I created one hyper simple collection. A single call with this in the Tests:
var token = postman.getResponseHeader("Authorization");
postman.setEnvironmentVariable("token", token);
tests["Successfully authenticated"] = token !== null;
In the GUI, it runs successfully. Running with newman, it does show a checkmark next to the “Successfully authenticated” test, but there’s still an [errored] which I imagine is because of the unexpected end of file at request. I’m running node v5.7.1 and newman v3.1.2
I’m not sure if this is related to https://github.com/postmanlabs/newman/issues/319 or not.
> newman run Compas_REST_Case_Tests.postman_collection.json -e Compas8_Blank.postman_environment.json
newman
Compas_REST_Case_Tests
→ Authenticate
POST http://localhost/Foo/api/authentication [errored]
√ Successfully authenticated
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 1 │ 1 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 1 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 986ms │
├───────────────────────────────────────────────┤
│ total data received: 0B (approx) │
├───────────────────────────────────────────────┤
│ average response time: 0ms │
└───────────────────────────────────────────────┘
# failure detail
1. Error unexpected end of file
at request
inside "Authenticate" of "Compas_REST_Case_Tests"
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (16 by maintainers)
Well, I fixed it. I’m not sure if this is considered a bug or what, but (I’ll share heavily heavily reduced code):
Like I said, the HttpResponse was lacking any body content, and was just sending back header data.
So, I went from:
to this:
And all is well!