Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Empty negotiated response with accept header of application/xml or text/xml throws serialization exception #2131

Closed
phoenixx opened this issue Nov 24, 2015 · 2 comments
Labels
Milestone

Comments

@phoenixx
Copy link
Contributor

Given a simple model which simply returns a 200 response:

 public class DemoModule : NancyModule
    {
        public DemoModule() : base("/demo")
        {
            Get["ok", "/"] =
                _ => Negotiate.WithStatusCode(HttpStatusCode.OK);
        }
    }

Making a GET request to this endpoint with an accept header of "application/json" returns an empty response with a status code of 200, as expected.

Making a GET request to this endpoint with an accept header of "text/xml" or "application/xml" returns a 500 internal server error with the following exception:

The type arguments for method 'Nancy.ISerializer.Serialize<TModel>(string, TModel, System.IO.Stream)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
@khellang khellang added the Bug label Nov 24, 2015
@khellang khellang added this to the 2.0 milestone Nov 24, 2015
phoenixx added a commit to phoenixx/Nancy that referenced this issue Nov 24, 2015
When the model passed to CreateResponse is null don't try to serialize
it as XML, effectively pass an empty body.
khellang added a commit that referenced this issue Nov 24, 2015
Fixes issue #2131 with XmlProcessor
@khellang
Copy link
Member

Closed by #2133

@thecodejunkie thecodejunkie modified the milestones: 1.4.3, 2.0 Dec 14, 2015
thecodejunkie pushed a commit that referenced this issue Dec 14, 2015
When the model passed to CreateResponse is null don't try to serialize
it as XML, effectively pass an empty body.
@khellang
Copy link
Member

Version 1.4.3 was just pushed to NuGet.

fxbit pushed a commit to yodiwo/Nancy that referenced this issue Aug 19, 2016
When the model passed to CreateResponse is null don't try to serialize
it as XML, effectively pass an empty body.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants