Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to use Fiddler to do an HTTP GET to my ASP.NET Web API Odata endpoint service. The URL contains OData commands to filter the results. I can use a browser or the Google extension 'Postman' and run the query and it works.

However, immediately upon placing the URL in Fiddler's 'Composer' tab it turns red. Upon executing the GET I get the following error:

HTTP Error 400. The request is badly formed

It's a bit of a red herring though as I think Fiddler had a problem with composing and sending the proper request that resulted in the response. Here is the URL with OData commands:

http://localhost/MyApp/odata/People()?$filter=Name eq 'John'

As mentioned, this query works in other tools, just not in Fiddler. As I am not a Fiddler expert and did not intuitively see and options to allow this or find any documentation, can anyone tell me if it's possible to compose and send this type of GET with OData commands using Fiddler?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Maybe Fiddler isn't automatically encoding spaces, like other tools might be? Try:

http://localhost/MyApp/odata/People()?$filter=Name%20eq%20'John'

You might also try encoding the single quotes around the string value.

Another thought is that Fiddler has some known issues with using "localhost", which I usually work around by putting a dot ('.') after localhost in the request URI:

http://localhost./MyApp/odata/People()?$filter=Name%20eq%20'John'
share|improve this answer
    
I just confirmed that Fiddler does not allow spaces in URIs. The input field for the URI will turn red, and executing the request will return a 400. Simply replacing the spaces with '%20' made everything work for me. –  Jen S Apr 26 '13 at 17:59
1  
Fiddler knows that unencoded spaces are illegal in URLs and warns you by turning the field red. The "localhost" issue is unrelated and derives from HTTP frameworks like System.NET bypassing proxies for localhost; Fiddler itself has no issue with the localhost hostname. –  EricLaw Apr 26 '13 at 18:08
    
Thanks for the clarification! –  Jen S Apr 26 '13 at 19:29
1  
The spaces were the issue. Adding in the encoded value of %20 fixed the issue. Thanks! –  atconway Apr 26 '13 at 19:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.