summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-05-29 17:11:59 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-05-29 17:11:59 -0700
commit1a9c7478deaa33507a553e20ae26aa0d5e8fd836 (patch)
treee95a529f1e2e9e691c35543dc2f94c3d04ee7fef
parentdf029e7a83f7393bfa1f8ca5cea7f732c70b48da (diff)
downloadDotNetOpenAuth-1a9c7478deaa33507a553e20ae26aa0d5e8fd836.zip
DotNetOpenAuth-1a9c7478deaa33507a553e20ae26aa0d5e8fd836.tar.gz
DotNetOpenAuth-1a9c7478deaa33507a553e20ae26aa0d5e8fd836.tar.bz2
Moved magic uri-encoded string to a constant.
-rw-r--r--src/DotNetOpenAuth/Messaging/Channel.cs8
-rw-r--r--src/DotNetOpenAuth/Messaging/HttpDeliveryMethods.cs2
-rw-r--r--src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs2
3 files changed, 9 insertions, 3 deletions
diff --git a/src/DotNetOpenAuth/Messaging/Channel.cs b/src/DotNetOpenAuth/Messaging/Channel.cs
index 64c717e..a75b0d6 100644
--- a/src/DotNetOpenAuth/Messaging/Channel.cs
+++ b/src/DotNetOpenAuth/Messaging/Channel.cs
@@ -28,6 +28,12 @@ namespace DotNetOpenAuth.Messaging {
[ContractClass(typeof(ChannelContract))]
public abstract class Channel : IDisposable {
/// <summary>
+ /// The content-type used on HTTP POST requests where the POST entity is a
+ /// URL-encoded series of key=value pairs.
+ /// </summary>
+ protected internal const string HttpFormUrlEncoded = "application/x-www-form-urlencoded";
+
+ /// <summary>
/// The encoding to use when writing out POST entity strings.
/// </summary>
private static readonly Encoding PostEntityEncoding = new UTF8Encoding(false);
@@ -846,7 +852,7 @@ namespace DotNetOpenAuth.Messaging {
ErrorUtilities.VerifyArgumentNotNull(httpRequest, "httpRequest");
ErrorUtilities.VerifyArgumentNotNull(fields, "fields");
- httpRequest.ContentType = "application/x-www-form-urlencoded";
+ httpRequest.ContentType = HttpFormUrlEncoded;
// Setting the content-encoding to "utf-8" causes Google to reply
// with a 415 UnsupportedMediaType. But adding it doesn't buy us
diff --git a/src/DotNetOpenAuth/Messaging/HttpDeliveryMethods.cs b/src/DotNetOpenAuth/Messaging/HttpDeliveryMethods.cs
index 309bad3..cbbe28e 100644
--- a/src/DotNetOpenAuth/Messaging/HttpDeliveryMethods.cs
+++ b/src/DotNetOpenAuth/Messaging/HttpDeliveryMethods.cs
@@ -26,7 +26,7 @@ namespace DotNetOpenAuth.Messaging {
AuthorizationHeaderRequest = 0x1,
/// <summary>
- /// As the HTTP POST request body with a content-type of application/x-www-form-urlencoded.
+ /// As the HTTP POST request body with a content-type of application/x-www-form-urlencoded.
/// </summary>
PostRequest = 0x2,
diff --git a/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs b/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
index 43bbc04..b1800d7 100644
--- a/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
+++ b/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs
@@ -233,7 +233,7 @@ namespace DotNetOpenAuth.Messaging {
get {
Contract.Ensures(Contract.Result<NameValueCollection>() != null);
if (this.form == null) {
- if (this.HttpMethod == "POST" && this.Headers[HttpRequestHeader.ContentType] == "application/x-www-form-urlencoded") {
+ if (this.HttpMethod == "POST" && this.Headers[HttpRequestHeader.ContentType] == Channel.HttpFormUrlEncoded) {
StreamReader reader = new StreamReader(this.InputStream);
long originalPosition = 0;
if (this.InputStream.CanSeek) {