@@ -128,30 +128,51 @@ internal static async Task<TypedData> ToRpcHttp(this HttpRequest request, ILogge
128
128
foreach ( var pair in request . Query )
129
129
{
130
130
var value = pair . Value . ToString ( ) ;
131
- if ( ! string . IsNullOrEmpty ( value ) )
131
+ if ( ShouldUseNullableValueDictionary ( capabilities ) )
132
132
{
133
- http . Query . Add ( pair . Key , value ) ;
133
+ http . NullableQuery . Add ( pair . Key , new NullableString { Value = value } ) ;
134
+ }
135
+ else
136
+ {
137
+ if ( ! string . IsNullOrEmpty ( value ) )
138
+ {
139
+ http . Query . Add ( pair . Key , value ) ;
140
+ }
134
141
}
135
142
}
136
143
137
144
foreach ( var pair in request . Headers )
138
145
{
139
- if ( ShouldIgnoreEmptyHeaderValues ( capabilities ) && string . IsNullOrEmpty ( pair . Value . ToString ( ) ) )
146
+ if ( ShouldUseNullableValueDictionary ( capabilities ) )
140
147
{
141
- continue ;
148
+ http . NullableHeaders . Add ( pair . Key . ToLowerInvariant ( ) , new NullableString { Value = pair . Value . ToString ( ) } ) ;
142
149
}
150
+ else
151
+ {
152
+ if ( ShouldIgnoreEmptyHeaderValues ( capabilities ) && string . IsNullOrEmpty ( pair . Value . ToString ( ) ) )
153
+ {
154
+ continue ;
155
+ }
143
156
144
- http . Headers . Add ( pair . Key . ToLowerInvariant ( ) , pair . Value . ToString ( ) ) ;
157
+ http . Headers . Add ( pair . Key . ToLowerInvariant ( ) , pair . Value . ToString ( ) ) ;
158
+ }
145
159
}
146
160
147
161
if ( request . HttpContext . Items . TryGetValue ( HttpExtensionConstants . AzureWebJobsHttpRouteDataKey , out object routeData ) )
148
162
{
149
163
Dictionary < string , object > parameters = ( Dictionary < string , object > ) routeData ;
150
164
foreach ( var pair in parameters )
151
165
{
152
- if ( pair . Value != null )
166
+ if ( ShouldUseNullableValueDictionary ( capabilities ) )
167
+ {
168
+ http . NullableParams . Add ( pair . Key , new NullableString { Value = pair . Value . ToString ( ) } ) ;
169
+ }
170
+ else
153
171
{
154
- http . Params . Add ( pair . Key , pair . Value . ToString ( ) ) ;
172
+ if ( pair . Value != null )
173
+ {
174
+ http . Params . Add ( pair . Key , pair . Value . ToString ( ) ) ;
175
+ }
155
176
}
156
177
}
157
178
}
@@ -364,6 +385,11 @@ private static bool ShouldIgnoreEmptyHeaderValues(Capabilities capabilities)
364
385
return ! string . IsNullOrEmpty ( capabilities . GetCapabilityState ( RpcWorkerConstants . IgnoreEmptyValuedRpcHttpHeaders ) ) ;
365
386
}
366
387
388
+ private static bool ShouldUseNullableValueDictionary ( Capabilities capabilities )
389
+ {
390
+ return ! string . IsNullOrEmpty ( capabilities . GetCapabilityState ( RpcWorkerConstants . UseNullableValueDictionaryForHttp ) ) ;
391
+ }
392
+
367
393
public static BindingInfo ToBindingInfo ( this BindingMetadata bindingMetadata )
368
394
{
369
395
BindingInfo bindingInfo = new BindingInfo
0 commit comments