newman -v): 3.8.3<http://redfish.dmtf.org/schemas/v1/ServiceRoot.v1_1_1.json>; rel=describedby, </redfish/v1/TaskService>; path=/Tasks, </redfish/v1/Chassis>; path=/Chassis, </redfish/v1/SessionService/Sessions>; path=/Links/Sessions, </redfish/v1/Managers>; path=/Managers, </redfish/v1/EventService>; path=/EventService, </redfish/v1/JsonSchemas>; path=/JsonSchemas, </redfish/v1/Systems>; path=/Systems, </redfish/v1/Registries>; path=/Registries, </redfish/v1/configurations>; path=/Oem/Ami/Configurations, </redfish/v1/SessionService>; path=/SessionService, </redfish/v1/AccountService>; path=/AccountService, </redfish/v1/UpdateService>; path=/UpdateService
Please help to look into this issue
Note. This issue can't reproduce in POSTMAN
@snk20501 Could you confirm that this still works correctly with v5.3.1 of the Postman app? I'll dig deeper into the header fetch issue in the meantime. 馃槃
@kunagpal The version I use is v5.3.0 and it works correctly. Thank you for looking into this problem. :)
I am also having the same issue.
@LeonardoGonzales Which version of Newman are you on? You can find this with newman -v.
Hello @kunagpal,
Thank you for the quick feedback.
I am using version 3.8.3 as well. I installed it using npm (npm install -g newman)
Hello @kunagpal,
postman.getResponseHeader is having the same issue in postman application for linux as well.
I downloaded Postman-linux-x64-5.3.2.tar.gz, installed my machine and faced the same error.
Google chrome application version 5.3.0 works for me.
The issue is reproducible in stand-alone Postman v.5.5.0
Google chrome application version 5.4.0 does not have this issue, reproducible in desktop version v.5.5.0
@snk20501 @LeonardoGonzales @zhak @borodaalex Could you try the following snippet out and let me know if it works for you?
pm.response.headers.one('my_header_name');
Hi guys, I have same issue,
response has following headers (pretty view):
Server 鈫抶xxxxxxx-xxxxx
Set-Cookie 鈫扐PSCOOKIE_9539865665021864916="0%260"; path=/; expires=Tue, 06-Feb-1968 18:34:11 GMT
Set-Cookie 鈫扸DOM_9539865665021864916="0%260"; path=/; expires=Tue, 06-Feb-1968 18:34:11 GMT
Set-Cookie 鈫抣og_filters="0%260"; path=/log/; expires=Tue, 06-Feb-1968 18:34:11 GMT
Set-Cookie 鈫抣og_type="0%260"; path=/log/; expires=Tue, 06-Feb-1968 18:34:11 GMT
Set-Cookie 鈫扖ENTRAL_MGMT_OVERRIDE_9539865665021864916="0%260"; path=/; expires=Tue, 06-Feb-1968 18:34:11 GMT
Set-Cookie 鈫扙DIT_HISTORY_9539865665021864916="0%260"; path=/; expires=Tue, 06-Feb-1968 18:34:11 GMT
Set-Cookie 鈫扚ILE_DOWNLOADING_9539865665021864916="0%260"; path=/; expires=Tue, 06-Feb-1968 18:34:11 GMT
Set-Cookie 鈫抍srftoken_9539865665021864916="0%260"; path=/; expires=Tue, 06-Feb-1968 18:34:11 GMT
Set-Cookie 鈫抍csrftoken_9539865665021864916="0%260"; path=/; expires=Tue, 06-Feb-1968 18:34:11 GMT
Set-Cookie 鈫抍csrftoken="0%260"; path=/; expires=Tue, 06-Feb-1968 18:34:11 GMT
for single value header all looks good:
postman.getResponseHeader('server') ----> "xxxxxxxx-xxxxx"
but for multi-value header like set-cookie we are receiving last element of array, at index 9:
postman.getResponseHeader('Set-Cookie') ----> "ccsrftoken="0%260"; path=/; expires=Tue, 06-Feb-1968 18:30:59 GMT"
also
pm.response.headers.one('Set-Cookie').value;----> "ccsrftoken="0%260"; path=/; expires=Tue, 06-Feb-1968 19:36:57 GMT"
So the clue is that getResponseHeader works incorrect and return last value of multivalue header
This function should return an array of all values for given header name
My workaround for a moment is to use
// print all Set-Cookie header values
pm.response.headers.all()
.filter(headerObj => { return headerObj.key == "Set-Cookie";})
.forEach(headerObj => {
console.log(headerObj.key +": "+headerObj.value)
})
BR, Karol
@kunagpal I try following script but still get the same result. The POSTMan version is the latest v5.5.2.
pm.response.headers.one('my_header_name');
My question is sort of related to this:
Is there a way to actually parse out 1 value inside a given header
example: postman gives me this response header
X-Pagination 鈫抺"TotalCount":6,"PageSize":5,"CurrentPage":1,"TotalPages":2,"PreviousPageLink":null,"NextPageLink":"http://localhost/v1/accounts?searchQuery=nam&pageNumber=2&pageSize=5"}
How do I extract TotalCount and its value?
@kdp88 did you try it:
var pageHeader = JSON.parse(postman.getResponseHeader('X-Pagination') );
console.log(pageHeader.TotalCount);
thank @ekarpie, your "work around" worked very well for me
Best Regards
Leo
@LeonardoGonzales you are the man dude, that worked flawlessly
how about extracting the TotalCount key and not the value.
for(var key in pageHeader){
console.log('Key'+key +' value: '+ pageHeader[key])
}
@LeonardoGonzales 2 for 2
I LIKE IT THANKS MAN!
So the debate is ... should we have a polymorphic function return signature for headers? i.e. return string for single and array for multiple. That may break many current use cases across Postman and Newman.
Or find a way to add another function that takes care of this / extra param to indicate allowing multi-value (and make all returns array when that param is set to true -> including for single value)?
So, what happens with query string duplication? @kamalaknn
Refer: https://github.com/postmanlabs/postman-app-support/issues/6143
Most helpful comment
Hi guys, I have same issue,
response has following headers (pretty view):
for single value header all looks good:
postman.getResponseHeader('server') ----> "xxxxxxxx-xxxxx"
but for multi-value header like set-cookie we are receiving last element of array, at index 9:
postman.getResponseHeader('Set-Cookie') ----> "ccsrftoken="0%260"; path=/; expires=Tue, 06-Feb-1968 18:30:59 GMT"
also
pm.response.headers.one('Set-Cookie').value;----> "ccsrftoken="0%260"; path=/; expires=Tue, 06-Feb-1968 19:36:57 GMT"
So the clue is that getResponseHeader works incorrect and return last value of multivalue header
This function should return an array of all values for given header name
My workaround for a moment is to use
BR, Karol