Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 5e7857e

Browse files
committed
Change SL5 to auto emulate HTTP Verbs when not GET or POST
1 parent 8697e4e commit 5e7857e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ServiceStack.Text/PclExport.Sl5.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ public override void Config(HttpWebRequest req,
6060
{
6161
if (allowAutoRedirect.HasValue) req.AllowAutoRedirect = allowAutoRedirect.Value;
6262
// if (userAgent != null) req.UserAgent = userAgent; //throws NotImplementedException
63+
64+
//Methods others than GET and POST are only supported by Client request creator, see
65+
//http://msdn.microsoft.com/en-us/library/cc838250(v=vs.95).aspx
66+
if (req.Method != "GET" && req.Method != "POST")
67+
{
68+
req.Headers[HttpHeaders.XHttpMethodOverride] = req.Method;
69+
req.Method = "POST";
70+
}
6371
}
6472

6573
public override HttpWebRequest CreateWebRequest(string requestUri, bool? emulateHttpViaPost = null)

0 commit comments

Comments
 (0)