Skip to content

Commit

Permalink
fixed auth header unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalo-oliveira committed Apr 22, 2024
1 parent 0913adf commit b7e4157
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Functions/HttpExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public static HttpRequestMessage ToHttpRequestMessage( this FunctionCall functio

var authorization = functionCall.Metadata.GetValueOrDefault( "Authorization", string.Empty );

if ( !string.IsNullOrEmpty( authorization ) )
{
httpContent.Headers.Add( "Authorization", authorization );
}
// if ( !string.IsNullOrEmpty( authorization ) )
// {
// httpContent.Headers.Add( "Authorization", authorization );
// }

foreach ( var header in functionCall.Metadata.Where( x => x.Key.StartsWith( "HTTP_HEADER_" )) )
{
Expand Down Expand Up @@ -45,6 +45,13 @@ public static HttpRequestMessage ToHttpRequestMessage( this FunctionCall functio

var uri = $"{gatewayUrl.TrimEnd( '/' )}/proxy/{functionName}{path}";

return new HttpRequestMessage( new HttpMethod( method ), uri );
var httpRequest = new HttpRequestMessage( new HttpMethod( method ), uri );

if ( !string.IsNullOrEmpty( authorization ) )
{
httpRequest.Headers.Add( "Authorization", authorization );
}

return httpRequest;
}
}

0 comments on commit b7e4157

Please sign in to comment.