1

I am trying to invoke a REST service which has a special character in its path params. The rest url looks like,

rest\fetchDetails\[1,2,3]

I am just invoking it using $http like,

$http.get('rest\fetchDetails\[1,2,3]');

It is not working and when I debug it using firebug I can see the url is sent as

rest\fetchDetails\%5B1,2,3%5D

Is there any way to send '[' and ']' when invoking $http calls?

2 Answers 2

5

Solution 1:

Try with post request and pass params in Post Request.

Solution 2:

'[]' are special characters for URL. So it will be encoded.

If you want to decode this are your server code you can do it.

Sign up to request clarification or add additional context in comments.

Comments

0

You are actually sending '[' and ']', however they are being url-encoded by the $http.get method. The url-encoding is necessary because the HTTP standard only allows some characters (alpha-numeric plus some) to be sent non-url-encoded.

BTW, I assume the backslashes () in your URL are regular slashes (/) since otherwise they too would be url-encoded.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.