I am using two http_req in my program. First one to fetch the authorisation code( this doesnt reuqire any additional headers ) second one to post my data( this requires additional headers ). When I run my programs the first time all works fine, but, when try it again ( without logging out and loggin in or in intreative more instead of batch ) I get 400 error for my authorisation code fetch request. When i debug i see that the additional headers are being added for the first request also. Any help in resolvng this is really appriciate.
Is this issue happening due to keep alive? My code sinppet is as below:
For fetch token :
Code: Select all
http_setOption( 'content-type' : 'application/x-www-form-urlencoded' );
http_debug(*On: '/tmp/HcfCwJsnDebuglog.txt');
rc = http_req( 'POST'
: %Trim( TokenUrl )
: %Trim( TokenResp )
: *Omit
: *Omit
: %Trim( TokenPayload ) );
If rc <>1;
errorMsg = http_error( xErrorNo );
http_comp('Error! xErrorNo: ' + %Char(xErrorNo) +
' errorMsg: ' + errorMsg );
Else;
http_comp('Success!' );
EndIf;
Code: Select all
http_setOption( 'content-type' : 'application/json' );
http_xproc( HTTP_POINT_ADDL_HEADER : %paddr(addSpecialHeaders)
Monitor;
rc = http_req( 'POST'
: %Trim( Url )
: %Trim( Response )
: *Omit
: *Omit
: %Trim( Payload ) );
If rc <>1;
errorMsg = http_error( xErrorNo );
http_comp('Error! xErrorNo: ' + %Char(xErrorNo) +
' errorMsg: ' + errorMsg );
Else;
http_comp('Success!' );
EndIf;