Merge pull request #465 from Scavenger3/RestJsonp

[Rest] Add support for jsonp
This commit is contained in:
Lucas Nicodemus 2012-11-25 04:37:06 -08:00
commit daf2d43dfc

View file

@ -125,6 +125,11 @@ namespace Rests
return;
var str = JsonConvert.SerializeObject(obj, Formatting.Indented);
var jsonp = e.Request.Parameters["jsonp"];
if (!string.IsNullOrWhiteSpace(jsonp))
{
str = string.Format("{0}({1});", jsonp, str);
}
e.Response.Connection.Type = ConnectionType.Close;
e.Response.ContentType = new ContentTypeHeader("application/json");
e.Response.Add(serverHeader);