Search code examples
httprequestmulehttp-status-code-400

Mule HTTP Request Response Code 400 with @ symbol in URL


** Question taken back **

I am using the HTTP:Request component in Mule 3.8 -

<http:request config-ref="httpRequestConfig" host="hostname" port="8081" path="validate/john.doe@gmail.com" method="GET" doc:name="HTTP Request" />

The HTTP Request Config looks like this -

<http:request-config name="httpRequestConfig" basePath="user" doc:name="HTTP Request Configuration" />

This results in a response code of 400 -

Root Exception stack trace:
org.mule.module.http.internal.request.ResponseValidatorException: Response code 400 mapped as failure.
    at org.mule.module.http.internal.request.SuccessStatusCodeValidator.validate(SuccessStatusCodeValidator.java:37)
    at org.mule.module.http.internal.request.DefaultHttpRequester.validateResponse(DefaultHttpRequester.java:356)
    at org.mule.module.http.internal.request.DefaultHttpRequester.innerProcess(DefaultHttpRequester.java:344)
    at org.mule.module.http.internal.request.DefaultHttpRequester.processBlocking(DefaultHttpRequester.java:217)

If I access the URL (http://hostname:8081/user/validate/john.doe@gmail.com) from Chrome, it works fine.

I know it is the @ symbol that is causing the issue. For a value without the @ symbol, the Mule flow works fine.

What could I be missing on the request?

Thanks for the help


Solution

  • URL has to be encoded for special characters. For your case replace @ character with %40 like this http://hostname:8081/user/validate/john.doe%40gmail.com

    It works for me, here is my code.

    <http:listener-config port="8081" name="config" host="0.0.0.0" />
    
    <flow name="test">
        <http:listener path="/Test/{emailAddress}" config-ref="config" />
        <logger level="INFO" message="#[message.inboundProperties.'http.uri.params'.emailAddress]"/>
    </flow>
    

    URL to test - http://localhost:8081/Test/senthil.test%40gmail.com