Skip to content

Commit

Permalink
Merge pull request #1439 from postmanlabs/feature/postman-request-ver…
Browse files Browse the repository at this point in the history
…sion-bump

Bumped postman-request to postman-request@2.88.1-postman.38
  • Loading branch information
codenirvana authored Aug 6, 2024
2 parents 710d285 + bf6a821 commit 4519b09
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 10 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"node-oauth1": "1.3.0",
"performance-now": "2.1.0",
"postman-collection": "4.5.0",
"postman-request": "2.88.1-postman.37",
"postman-request": "2.88.1-postman.38",
"postman-sandbox": "5.1.1",
"postman-url-encoder": "3.0.5",
"serialised-error": "1.1.3",
Expand Down
60 changes: 58 additions & 2 deletions test/integration/request-flow/headers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,25 @@ var sinon = require('sinon'),
}]
}
}
}, {
name: 'http2',
request: {
url: 'https://postman-echo.com/get',
method: 'GET'
},
protocolProfileBehavior: {
protocolVersion: 'http2'
}
},
{
name: 'auto',
request: {
url: 'https://postman-echo.com/get',
method: 'GET'
},
protocolProfileBehavior: {
protocolVersion: 'auto'
}
}]
}
}, function (err, results) {
Expand All @@ -131,8 +150,8 @@ var sinon = require('sinon'),
sinon.assert.calledOnce(testrun.done);
sinon.assert.calledWith(testrun.done.getCall(0), null);

sinon.assert.callCount(testrun.request, 6);
sinon.assert.callCount(testrun.response, 6);
sinon.assert.callCount(testrun.request, 8);
sinon.assert.callCount(testrun.response, 8);
});

it('should handle duplicate headers correctly', function () {
Expand Down Expand Up @@ -263,4 +282,41 @@ var sinon = require('sinon'),
expect(request.headers.members[request.headers.count() - 1])
.to.deep.equal(new Header({ key: 'Content-Length', system: true, value: '253' }));
});

it('should have all request headers in http2 in debug data', function () {
sinon.assert.calledWith(testrun.request.getCall(6), null);
sinon.assert.calledWith(testrun.response.getCall(6), null);

var history = testrun.response.getCall(6).lastArg,
executionData = history.execution.data[0],
requestHeaders = executionData.request.headers;

const headersToCheck = new Set(['accept', 'cache-control', 'accept-encoding',
'cookie', 'postman-token', ':path', ':method', ':authority', ':scheme', 'user-agent']);

expect(executionData.response.httpVersion).to.eql('2.0');

requestHeaders.forEach(({ key }) => {
expect(headersToCheck.has(key.toLowerCase())).to.eql(true, `Header ${key} not found`);
});
});

it('should have all request headers in http2 in debug auto', function () {
sinon.assert.calledWith(testrun.request.getCall(7), null);
sinon.assert.calledWith(testrun.response.getCall(7), null);

var history = testrun.response.getCall(7).lastArg,
executionData = history.execution.data[0],
requestHeaders = executionData.request.headers;


const headersToCheck = new Set(['accept', 'cache-control', 'accept-encoding',
'cookie', 'postman-token', ':path', ':method', ':authority', ':scheme', 'user-agent']);

expect(executionData.response.httpVersion).to.eql('2.0');

requestHeaders.forEach(({ key }) => {
expect(headersToCheck.has(key.toLowerCase())).to.eql(true, `Header ${key} not found`);
});
});
});

0 comments on commit 4519b09

Please sign in to comment.