Created
June 21, 2012 20:14
-
-
Save tugberkugurlu/2968263 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Request: | |
---------------------------------------------------------------------------- | |
GET http://localhost:49207/api/cars HTTP/1.1 | |
User-Agent: Fiddler | |
Host: localhost:49207 | |
Accept: application/json | |
Response: | |
---------------------------------------------------------------------------- | |
HTTP/1.1 200 OK | |
Cache-Control: no-cache | |
Pragma: no-cache | |
Content-Type: application/json; charset=utf-8 | |
Expires: -1 | |
Server: Microsoft-IIS/7.5 | |
X-AspNet-Version: 4.0.30319 | |
X-SourceFiles: =?UTF-8?B?QzpcYXBwc1xAcG9zdHNcQ29ubmVnV2l0aEV4Y2x1ZGVNYXRjaE9uVHlwZU9ubHlcQ29ubmVnV2l0aEV4Y2x1ZGVNYXRjaE9uVHlwZU9ubHlcYXBpXGNhcnM=?= | |
X-Powered-By: ASP.NET | |
Date: Thu, 21 Jun 2012 20:14:09 GMT | |
Content-Length: 17 | |
["Car 1","Car 2"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Request: | |
---------------------------------------------------------------------------- | |
GET http://localhost:49207/api/cars HTTP/1.1 | |
User-Agent: Fiddler | |
Host: localhost:49207 | |
Response: | |
---------------------------------------------------------------------------- | |
HTTP/1.1 406 Not Acceptable | |
Cache-Control: no-cache | |
Pragma: no-cache | |
Expires: -1 | |
Server: Microsoft-IIS/7.5 | |
X-AspNet-Version: 4.0.30319 | |
X-SourceFiles: =?UTF-8?B?QzpcYXBwc1xAcG9zdHNcQ29ubmVnV2l0aEV4Y2x1ZGVNYXRjaE9uVHlwZU9ubHlcQ29ubmVnV2l0aEV4Y2x1ZGVNYXRjaE9uVHlwZU9ubHlcYXBpXGNhcnM=?= | |
X-Powered-By: ASP.NET | |
Date: Thu, 21 Jun 2012 20:13:02 GMT | |
Content-Length: 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Application_Start(object sender, EventArgs e) { | |
var config = GlobalConfiguration.Configuration; | |
var routes = config.Routes; | |
// From DefaultContentNegotiator class: | |
// If ExcludeMatchOnTypeOnly is true then we don't match on type only which means | |
// that we return null if we can't match on anything in the request. This is useful | |
// for generating 406 (Not Acceptable) status codes. | |
config.Services.Replace( | |
typeof(IContentNegotiator), | |
new DefaultContentNegotiator(excludeMatchOnTypeOnly: true) | |
); | |
routes.MapHttpRoute( | |
"DefaultHttpRoute", | |
"api/{controller}/{id}", | |
new { id = RouteParameter.Optional } | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment