Forum Discussion

acsc's avatar
acsc
New Contributor
6 years ago

Testrunner not adding "Authorization" in RAW REST request

 am trying run my test cases through testrunner but REST request do not add "Authorization" and it fails. Please let me know how to include auth in RAW request through testrunner.

Note: I am using SPNEGO/Kerberos auth and generate my token through kinit.exe

 

 

Here are the RAW request from UI and test runner -

 

 

POST http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Accept-Encoding: gzip,deflate

Content-Type: application/json

Content-Length: 2264

Host: xxxxxxxxxxxxxxxxxxxxxx

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

Authorization: Negotiate YIIGXwYGKwYBBQU

 

 

----------------------------------------------------------------------------------------

 

Host: xxxxxxxxxxxxxxxxxxxxxxxxxxx

Content-Length: [2264]

Accept-Encoding: [gzip,deflate]

User-Agent: [Apache-HttpClient/4.1.1 (java 1.5)]

Connection: [Keep-Alive]

Content-Type: [application/json]

POST http://xxxxxxxxxxxxxxx

Accept-Encoding: gzip,deflate

Content-Type: application/json

Content-Length: 2264

Host: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

 

---------------------------------------------------------------------------------------

2 Replies

  • acsc

     

    you can use below code if you want to get "Authorization" in your response:

     

    def getRequestTestStep = testRunner.testCase.getTestStepByName("TestRequest")
    def getRequestData = new String(getRequestTestStep.testRequest.messageExchange.rawRequestData)
    log.info getRequestData

    Hit Like if it resolve your problem.

     

    Thanks,

    Himanshu Tayal

    • acsc's avatar
      acsc
      New Contributor

      Ok, Thanks,

       

      But i need to add Auth token from an external file to RAW request before i hit the end point.