diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-08-18 23:31:53 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-08-18 23:45:16 -0700 |
commit | bec5883b9f446317f3c494b3a6b35560b951c2bc (patch) | |
tree | e8a434a1d518302a21fa5638791fe9a9952dcc95 /src/DotNetOpenAuth/OAuth/ChannelElements | |
parent | 3e440e1b1a7be2eb20358e8b467da46b8afbd5b6 (diff) | |
download | DotNetOpenAuth-bec5883b9f446317f3c494b3a6b35560b951c2bc.zip DotNetOpenAuth-bec5883b9f446317f3c494b3a6b35560b951c2bc.tar.gz DotNetOpenAuth-bec5883b9f446317f3c494b3a6b35560b951c2bc.tar.bz2 |
Added capability to send PUT and DELETE HTTP requests using OAuth.
Diffstat (limited to 'src/DotNetOpenAuth/OAuth/ChannelElements')
-rw-r--r-- | src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs | 6 | ||||
-rw-r--r-- | src/DotNetOpenAuth/OAuth/ChannelElements/OAuthHttpMethodBindingElement.cs | 12 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs index a1939dd..a59d9ba 100644 --- a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs +++ b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs @@ -203,6 +203,10 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { httpRequest = this.InitializeRequestAsPost(request); } else if ((transmissionMethod & HttpDeliveryMethods.GetRequest) != 0) { httpRequest = InitializeRequestAsGet(request); + } else if ((transmissionMethod & HttpDeliveryMethods.PutRequest) != 0) { + httpRequest = this.InitializeRequestAsPut(request); + } else if ((transmissionMethod & HttpDeliveryMethods.DeleteRequest) != 0) { + httpRequest = InitializeRequestAsDelete(request); } else { throw new NotSupportedException(); } @@ -292,7 +296,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { if (signedMessage != null) { return signedMessage.HttpMethod; } else { - return (message.HttpMethods & HttpDeliveryMethods.PostRequest) != 0 ? "POST" : "GET"; + return MessagingUtilities.GetHttpVerb(message.HttpMethods); } } diff --git a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthHttpMethodBindingElement.cs b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthHttpMethodBindingElement.cs index c9df0e8..37fb80b 100644 --- a/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthHttpMethodBindingElement.cs +++ b/src/DotNetOpenAuth/OAuth/ChannelElements/OAuthHttpMethodBindingElement.cs @@ -42,15 +42,13 @@ namespace DotNetOpenAuth.OAuth.ChannelElements { if (oauthMessage != null) { HttpDeliveryMethods transmissionMethod = oauthMessage.HttpMethods; - if ((transmissionMethod & HttpDeliveryMethods.PostRequest) != 0) { - oauthMessage.HttpMethod = "POST"; - } else if ((transmissionMethod & HttpDeliveryMethods.GetRequest) != 0) { - oauthMessage.HttpMethod = "GET"; - } else { + try { + oauthMessage.HttpMethod = MessagingUtilities.GetHttpVerb(transmissionMethod); + return MessageProtections.None; + } catch (ArgumentException ex) { + Logger.OAuth.Error("Unrecognized HttpDeliveryMethods value.", ex); return null; } - - return MessageProtections.None; } else { return null; } |