Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
GetResponseHeaderField working postman
is this supposed to be working in postman?
Response = HTTP_Services('GetResponseHeaderField', 'Content-Length')
Response = HTTP_Services('GetResponseHeaderField', 'Content-Length')
Comments
I was just checking an idea that I could preset known values that I need in a POST.
So, at the end of a GET I did a setResponseHeaderField and to test if I could get it back I did a GetResponseHeaderField which did not return a value, so I did the Response = HTTP_Services('GetResponseHeaderField', 'Content-Length') to see if anything was working.
In my api at the end I do:
http_services("SetRequestHeaderField","TESTING","ThisIsATest")
I see it in the postman headers at the top (where the authorisation is)
at the start (2nd time) I do:
ThisKey = http_services("GetRequestHeaderField","TESTING")
I have no value returned.
Am I only allowed to set/get the keys that are standard (i.e. the ones that are there / show up in the meta data call tip?
How can I set values that are 'global' for the duration of the web session.?
http_services("SetRequestHeaderField","TESTING","ThisIsATest")
This is not a service you should be using. This exists purely for the benefit of the HTTP Framework so that it can take the incoming request headers from the client (e.g., Postman) and store them early on so that in your API code you can use the GetRequestHeaderField to read the value and use it as you see fit.
Are you saying you created a header in the Postman request called TESTING and gave it a value of "ThisIsATest"? Is this what you are trying to observe in your API code?
ThisKey = http_services("GetRequestHeaderField","TESTING")
I have no value returned.
What do you mean "2nd time"? Do you mean the 2nd time you submit the request from Postman?
You can set custom headers but you have to define them first in the Registry entry for OECGI4. See this article.
This depends on how you define "web session". Normally this means one request and one response. In this context, if you set a request header then that value will remain constant during the execution of your API until you send back a response.
If by "web session" you mean from the time a user logs into your web-based application until the time your user logs off of your web-based application, then that is something you must implement on your own. The communication protocol of the web, HTTP, is stateless, which means it does not maintain values from request to request, etc. One way to overcome this is through a cookie. See the SetCookie service. Another way to overcome this is to create your own sever-side session manager. This would be an OI application running on the server that tracks traffic coming in and looks for identification, such as the Authorization header or a cookie, to associate with a record you maintain.
Is there by doing this in my api:
http_services("SetRequestHeaderField","TESTING","ThisIsATest")
The first time the SetRequestHeaderField woild be set at the end so, no value would be expected by the GetRequestHeaderField at first execution until executed again (2nd time)
FYI:
this was set in my api and is still there when a resonse is returned.
Anyway, I am obviously not up to speed with how this is all supposed to hang to-gether, so obviously any result I am not getting from now on I know it must not be allowed, so I will try another way.
Just trying to retrofit/convert a inet_ html proc
http_services("SetRequestHeaderField","TESTING","ThisIsATest")
That doesn't happen and your image doesn't show it. That call assigns two OI variables, nothing more. They're common variables so you can retrieve it at anytime within the processing of the request but it has no effect on anything external to the immediate OI session. Postman will never be aware of it.
With your morning fresh eyes you might notice that the request header in Postman is "TESTIT" not "TESTING".
I'd take a punt and say that you manually added "TESTIT" as a header in some previous test. If you're using the same request it will stick around.
All HTTP calls begin with the client sending a request to the server. In this request, the client can send the following:
A request body.">
I dont really want to set a value from my api, just get a value from the GET method sent, from the REQUEST header.
I still cant get my TESTIT value by doing ThisValue = http_services("GetRequestHeaderField","TESTIT")
and I just see the standard ones in here RequestHeaderFields =http_services("GetRequestHeaderFields")
I thought, in the first instance, the additionalvalues was your routines somehow.
Now all good, but, now I have to remember, dont delete this conversation. ๐