Hi,
I tried service callout policy and assign message policy to fetch cookie and CSRF token .And assign the both in headers using assign message policy. when I am assigning cookie in headers through assign message policy unnecessary values are there so that we are getting error as CSRF token validation failed.
Example: cookie: sap-user context=sap-client=20; path=/ SAP_SESSIONID_D5_20=c_BbvQ_eMAYW2ixyZy9BZRNUbchHsrH8AUFasPzY%3d; path=/
I need to remove "path=/" words from overall cookie. How to remove that using JavaScript
The Path element is valid within Set-Cookie
:
Set-Cookie: <cookie-name>=<cookie-value>; Path=<path-value>
See the Mozilla documentation for more details.
I understand you're seeing a path=
element within the Cookie header. ie: as part of a cookie within a request. That's not valid. (Mozilla doc)
You can set any header to any string value you like, within JavaScript.
context.setVariable('request.header.cookie', 'any-value-you-like');
I suppose you'd be able to do something similar within AssignMessage too.
<AssignMessage name='AM-Override-Cookie'>
<Set>
<Headers>
<Header name='Cookie'>value-goes-here</Header>
</Headers>
</Set>
</AssignMessage>
You didn't show what you tried.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |