Skip to content

Commit

Permalink
Adding HttpHeader.Common.FormUrlEncodedContentType fixes #6646 (#6648)
Browse files Browse the repository at this point in the history
* Adding HttpHeader.Common.FormUrlEncodedContentType fixes #6646

* fixing copy paste error

* updates addressing PR feedback
  • Loading branch information
schaabs authored Jun 20, 2019
1 parent a91073c commit c6659f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sdk/core/Azure.Core/src/Pipeline/HttpHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ public static class Common
{
static readonly string s_applicationJson = "application/json";
static readonly string s_applicationOctetStream = "application/octet-stream";
static readonly string s_applicationFormUrlEncoded = "application/x-www-form-urlencoded";

public static readonly HttpHeader JsonContentType = new HttpHeader(Names.ContentType, s_applicationJson);
public static readonly HttpHeader JsonAccept = new HttpHeader(Names.Accept, s_applicationJson);
public static readonly HttpHeader OctetStreamContentType = new HttpHeader(Names.ContentType, s_applicationOctetStream);
public static readonly HttpHeader FormUrlEncodedContentType = new HttpHeader(Names.ContentType, s_applicationFormUrlEncoded);
}
}
}
5 changes: 3 additions & 2 deletions sdk/identity/Azure.Identity/src/IdentityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Buffers;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
Expand Down Expand Up @@ -171,7 +172,7 @@ private Request CreateClientSecretAuthRequest(string tenantId, string clientId,

request.Method = HttpPipelineMethod.Post;

request.Headers.SetValue("Content-Type", "application/x-www-form-urlencoded");
request.Headers.Add(HttpHeader.Common.FormUrlEncodedContentType);

request.UriBuilder.Uri = _options.AuthorityHost;

Expand All @@ -194,7 +195,7 @@ private Request CreateClientCertificateAuthRequest(string tenantId, string clien

request.Method = HttpPipelineMethod.Post;

request.Headers.SetValue("Content-Type", "application/x-www-form-urlencoded");
request.Headers.Add(HttpHeader.Common.FormUrlEncodedContentType);

request.UriBuilder.Uri = _options.AuthorityHost;

Expand Down

0 comments on commit c6659f4

Please sign in to comment.