Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
SetCookie/GetCookie
Can you confirm that GetCookie is working.
I see this in Postman after doing Response = HTTP_Services('SetCookie', 'ThisIsACookie','CookieValue')

I then do at the start of my api :
Both values are empty.
Do I need to add 'set-cookie' to additionalvalues in registry (if so, can that be added to the documentation)
C is for Cookie, That's Good Enough For Me
Cookies have long been a valuable tool for maintaining state, implementing authentication, and tracking history with web applications. The SRP HTTP Framework has always supported cookies via the SetResponseHeaderField service (a member of the HTTP_Services module) and the GetResponseHeaderField service (a member of the HTTPClient_Services module). However, a recent project convinced us that Cookies needed a little first-class citizen love. Therefore we have added a few new services so baking and consuming cookies is much yummier:
SetCookie (a member of the HTTP_Services module) - Adds a Set-Cookie header to the response using the indicated Name. The cookie's value and optional attributes will automatically be included as indicated by each argument.
GetCookies (a member of the HTTPClient_Services module) - Returns all cookie strings from the response headers.
GetCookie (a member of the HTTPClient_Services module) - Returns the value for the indicated cookie name.
Cookies have long been a valuable tool for maintaining state, implementing authentication, and tracking history with web applications. The SRP HTTP Framework has always supported cookies via the SetResponseHeaderField service (a member of the HTTP_Services module) and the GetResponseHeaderField service (a member of the HTTPClient_Services module). However, a recent project convinced us that Cookies needed a little first-class citizen love. Therefore we have added a few new services so baking and consuming cookies is much yummier:
SetCookie (a member of the HTTP_Services module) - Adds a Set-Cookie header to the response using the indicated Name. The cookie's value and optional attributes will automatically be included as indicated by each argument.
GetCookies (a member of the HTTPClient_Services module) - Returns all cookie strings from the response headers.
GetCookie (a member of the HTTPClient_Services module) - Returns the value for the indicated cookie name.
I see this in Postman after doing Response = HTTP_Services('SetCookie', 'ThisIsACookie','CookieValue')

I then do at the start of my api :
1 2 3 | MyCookie = HTTPclient_Services( 'GetCookie' , 'ThisIsACookie' ) ResponseHeaderFields = HTTPClient_Services( 'GetResponseHeaderFields' ) debug |
Both values are empty.
Do I need to add 'set-cookie' to additionalvalues in registry (if so, can that be added to the documentation)
Comments
At the END of the api I did- HTTP_Services('SetCookie', 'NextAction','DayList')
so next call to the api
MyCookie = HTTPclient_Services('GetCookie', 'NextAction')
error =Error_Services('GetMessage')
error = 'Set-Cookie is not a header field in the response.'
This is in the request headers:
Also noticed in the postman headers at the top - assume request headers?
Now I am absolutely totally confused.
Cookies=http_services('getRequestHeaderField','Cookie')
this returns the cookies and their '=' values.
Which makes sense to me as per a previous discussion, unless I have screwed up again, a 'request' to the server can only get request headers not response headers.
add HTTP_COOKIE to additionalvalues in the registry for OECGI4
set a cookie and its value using HTTP_Services('SetCookie'
To get cookies set by the same endpoint I do:
MyCookies = http_services(
'getRequestHeaderField'
,
'Cookie'
)
convert
';='
to
@fm
:
@vm
in
mycookies
CookieFields =
null$
CookieValues =
null$
For
Each Field
in
mycookies
using
@FM
CookieFields<
-1
> =Field<
0
,
1
>
CookieValues<
-1
> =Field<
0
,
2
>
Next
Field
Ok, all I want to know is are you happy that HTTP_Services ('SetCookie' and ' HTTPclient_Services('GetCookie', works.