Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added support for application/json-patch content type #863

Merged
merged 1 commit into from

2 participants

@ehanneken

Added support for application/json-patch (or application/json-*) to default JSON serializer and body deserializer.
IETF draft spec is at http://tools.ietf.org/html//draft-ietf-appsawg-json-patch-07
Nancy forum discussion here: https://groups.google.com/forum/#!topic/nancy-web-framework/5q2DmaOVlc0/discussion

JSON Patch is a JSON-based format specifically designed for PATCHing JSON documents. Its media type is "application/json-patch", which Nancy does not realize it can parse.

Eric Hanneken Added support for application/json-patch (or application/json-*) to d…
…efault JSON serializer and body deserializer.
d650dd0
@thecodejunkie thecodejunkie merged commit 4e33292 into NancyFx:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 13, 2012
  1. Added support for application/json-patch (or application/json-*) to d…

    Eric Hanneken authored
    …efault JSON serializer and body deserializer.
This page is out of date. Refresh to see the latest.
View
1  src/Nancy/Json/Json.cs
@@ -118,6 +118,7 @@ public static bool IsJsonContentType(string contentType)
var contentMimeType = contentType.Split(';')[0];
return contentMimeType.Equals("application/json", StringComparison.InvariantCultureIgnoreCase) ||
+ contentMimeType.StartsWith("application/json-", StringComparison.InvariantCultureIgnoreCase) ||
contentMimeType.Equals("text/json", StringComparison.InvariantCultureIgnoreCase) ||
(contentMimeType.StartsWith("application/vnd", StringComparison.InvariantCultureIgnoreCase) &&
contentMimeType.EndsWith("+json", StringComparison.InvariantCultureIgnoreCase));
View
1  src/Nancy/Responses/DefaultJsonSerializer.cs
@@ -67,6 +67,7 @@ private static bool IsJsonType(string contentType)
var contentMimeType = contentType.Split(';')[0];
return contentMimeType.Equals("application/json", StringComparison.InvariantCultureIgnoreCase) ||
+ contentMimeType.StartsWith("application/json-", StringComparison.InvariantCultureIgnoreCase) ||
contentMimeType.Equals("text/json", StringComparison.InvariantCultureIgnoreCase) ||
(contentMimeType.StartsWith("application/vnd", StringComparison.InvariantCultureIgnoreCase) &&
contentMimeType.EndsWith("+json", StringComparison.InvariantCultureIgnoreCase));
Something went wrong with that request. Please try again.