Ask a Question

How to Parse/Split HTTP Response Header and transfer to property

tsrinathreddy
New Contributor

How to Parse/Split HTTP Response Header and transfer to property

I am obtaining the following response to a HTTP Request in SOAP UI

TTP/1.1 201 CreatedX-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=blockCache-Control: no-cache, no-store, max-age=0, must-revalidatePragma: no-cacheExpires: 0X-Frame-Options: DENYLocation: /api/authorization_servers/5362c2c46362f0e7f33379e8
Content-Type: application/jsonTransfer-Encoding: chunked

I would like to get the value of 5362c2c46362f0e7f33379e8 in the Location Response Header and transfer it to a Project property called "token". Can someone tell me how I am going to do that?

I am able to get the entire /api/authorization_servers/5362c2c46362f0e7f33379e​8 into a variable through Groovy script in this way:

def headerValue = testRunner.testCase.getTestStepByName("Register Authorization Server").httpRequest.response.responseHeaders["Loc​ation"]

I have tried Split method, but it did not work with SOAPUI5.2 and Pro versions.

I am not able to proceed any further. Any help is greatly appreciated!

cancel
Showing results for 
Search instead for 
Did you mean: