I'm using OpenRasta framework in a .net service and I have two methods as below in the handler
public OperationResult Get(int Number)
{
// Do some operation and get an entity
return new OperationResult.OK(Single-MyResource);
}
public OperationResult GetQ()
{
// Do some operation and get an entity
return new OperationResult.OK(List-Of-MyResource);
}
My configuration looks like below
ResourceSpace.Has.ResourcesOfType<MyResource>()
.AtUri("/MyResource/{Id}")
.And.AtUri("/MyResource")
.HandledBy<MyResourceHandler>()
.AsJsonDataContract()
.And.AsXmlDataContract()
ResourceSpace.Has.ResourcesOfType<IList<MyResource>>()
.AtUri("/MyResources")
.HandledBy<MyResourceHandler>()
.AsJsonDataContract()
.And.AsXmlDataContract();
HttpMethod: GET AcceptHeader: "application/json" URI: http://testDomain.com/MyResource/
The above request gives me the List of MyResource , same as what i get for the below Request
HttpMethod: GET AcceptHeader: "application/json" URI: http://testDomain.com/MyResources/
After changing Configuration to
ResourceSpace.Has.ResourcesOfType<MyResource>()
.AtUri("/MyResource/{Id}")
.And.AtUri("/MyResource").Named("MyResource")
.HandledBy<MyResourceHandler>()
.AsJsonDataContract()
.And.AsXmlDataContract()
and making appropriate change in handler i.e
[HttpOperation(HttpMethod.GET, ForUriName = "MyResource")]
OpenRasta returns 415 http Status Code.
The above is not consistent again.
For my other Resource for similar configuration as above OpenRasta throws 403 http Status Code