diff --git a/src/WebApiContrib.Formatting.Jsonp/JsonpMediaTypeFormatter.cs b/src/WebApiContrib.Formatting.Jsonp/JsonpMediaTypeFormatter.cs index 0c6e43e..5ed6098 100644 --- a/src/WebApiContrib.Formatting.Jsonp/JsonpMediaTypeFormatter.cs +++ b/src/WebApiContrib.Formatting.Jsonp/JsonpMediaTypeFormatter.cs @@ -161,7 +161,7 @@ public override async Task WriteToStreamAsync(Type type, object value, Stream st { // the /**/ is a specific security mitigation for "Rosetta Flash JSONP abuse" // the typeof check is just to reduce client error noise - writer.Write("/**/ typeof " + _callback + " === 'function' && " + _callback + "("); + writer.Write("/**/typeof {0}==='function'&&{0}(", _callback ?? _callbackQueryParameter); writer.Flush(); await _jsonMediaTypeFormatter.WriteToStreamAsync(type, value, stream, content, transportContext); writer.Write(");");