I have an API name loginUser, which generates the authorization Token, that is to be passed in other subsequent APIs.
Below is the response:-
HTTP/1.1 200 OK Date: Sat, 10 Nov 2018 07:08:45 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 71 Connection:
keep-alive Server: nginx/1.10.3 (Ubuntu)
X-Powered-By: Express Access-Control-Allow-Origin: * Access-Control-Expose-Headers: date, authorization, x-powered-by, connection, server, access-control-allow-origin, content-type, content-length, x-final-url
authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIyYmEyYjc1My03NWEwLTQxNGYtYWFiOC0zZGY1M2I4YmIwMDEiLCJpc0Nvb2siOnRydWUsImlhdCI6MTU0MTgzMzcyNX0.3FRVpHm4EF2Ahzzy-OjbZ2EeZto6-hSFKHNtG5wcjBs
Where I want to fetch the authorization.
I'm using Regular Expression Extractor, but it is throwing below error
org.apache.http.client.ClientProtocolException: URI does not specify a valid host name: http:/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI4MWFiNzI3NS01MWU2LTQyMTctYmJlNC03ZTJlYjk1Y2M1NGYiLCJpc0Nvb2siOnRydWUsImlhdCI6MTU0MTk5NDY0NX0.kI0VrNARu09iG589g80ruqNFkoUQDg2iI9sw2nOuasU at org.apache.http.impl.client.CloseableHttpClient.determineTarget(CloseableHttpClient.java:95)
Snapshots:-
[Step_1][1]
[Step_2][2]
[Step_3][3]
[Step_4][4]
[1]: https://i.stack.imgur.com/x2aC8.png
[2]: https://i.stack.imgur.com/plORl.png
[3]: https://i.stack.imgur.com/Xe6aY.png
[4]: https://i.stack.imgur.com/FQMjZ.png
Please let me know, what can be done to solve this issue. Thanks in advance.
The error you're getting is not related to the Regular Expression Extractor at all, it is about some HTTP Request sampler having incorrect hostname
As far as I can see you can successfully extract the header value, but you should not be using it as the hostname, most probably it should go:
So you need to find out how the token should be passed and provide the variable from the regular expression extractor there, but it is obviously not "Server Name or IP" field of the HTTP Request sampler.
Be aware of existence of the alternative way of recording a JMeter test which automatically detects handles dynamic parameters so you will not have to worry about extracting and substituting dynamic values. Check out How to Cut Your JMeter Scripting Time by 80% article for more details