Skip to content

Commit 42fcba2

Browse files
authored
Add missing cancellation token; support multipart form content type (#745)
1 parent 388f939 commit 42fcba2

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/Transports.AspNetCore/GraphQLHttpMiddleware.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,21 @@ public virtual async Task InvokeAsync(HttpContext context, RequestDelegate next)
116116
bodyGQLRequest = await DeserializeFromGraphBodyAsync(httpRequest.Body);
117117
break;
118118

119-
case MediaType.FORM:
120-
var formCollection = await httpRequest.ReadFormAsync();
121-
try
122-
{
123-
bodyGQLRequest = DeserializeFromFormBody(formCollection);
124-
}
125-
catch (Exception ex)
119+
default:
120+
if (httpRequest.HasFormContentType)
126121
{
127-
if (!await HandleDeserializationErrorAsync(context, ex))
128-
throw;
122+
var formCollection = await httpRequest.ReadFormAsync(cancellationToken);
123+
try
124+
{
125+
bodyGQLRequest = DeserializeFromFormBody(formCollection);
126+
}
127+
catch (Exception ex)
128+
{
129+
if (!await HandleDeserializationErrorAsync(context, ex))
130+
throw;
131+
}
132+
break;
129133
}
130-
break;
131-
132-
default:
133134
await HandleInvalidContentTypeErrorAsync(context);
134135
return;
135136
}

0 commit comments

Comments
 (0)