-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddQueryString generates invalid url #44
Comments
Sorry for the delay in getting back to you. We generated the URL this way because it is still syntactically valid, and it cut down on the code required to generate the string. Is there a situation where it is causing the code to error out? |
Yes I have this problem too. It is apparently not necessarily syntactically correct to have the & right after the ?. I am getting response code 400 Invalid Request Parameter, and the reason is exactly that: the &. It would be helpful to have this fixed, even if there is a bit of effort to generate the proper string. |
RFC3986 does not specifically exclude this syntax, and IIS for example is able to handle it properly. What service are you trying to access that is experiencing the error? |
http://realtime.mbta.com/developer/api/v2/routes?&api_key=wX9NwuHnZU2ToO7GmGR9uw&format=json You can use this directly as above, and you get the 400 error with "Invalid query parameter:" Remove the initial "&" and it works. This does use IIS, and may or may not be stopped at the server level, but as you can see it does not work. Others are clearly having this problem too as noted. I wouldn't be surprised if the reason other people are trying to investigate 400 errors, as noted in other issues here, are having the same problem. |
Incorrectly Generates url as:
"http://mydomain.com/v2/EndPointName/?&sample=12"
Should be:
"http://mydomain.com/v2/EndPointName/?sample=12"
var request = new RestRequest("EndPointName/"), System.Net.Http.HttpMethod.Post);
request.AddQueryString("sample", 12);
var client = new RestClient();
client.BaseUrl = "http://mydomain.com/v2/";
// .. add some headers
RestResponse response = await client.SendAsync(request);
The text was updated successfully, but these errors were encountered: