We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 423dcab commit 8e00824Copy full SHA for 8e00824
src/Extensions.HotChocolate/Validation/BewitAuthorizationMiddleware.cs
@@ -55,15 +55,15 @@ public async Task InvokeAsync(IMiddlewareContext context)
55
private void CreateError(IMiddlewareContext context, Exception ex = default)
56
{
57
IErrorBuilder errorBuilder = ErrorBuilder.New()
58
- .SetMessage("NotAuthorized")
59
- .SetPath(context.Path)
60
- .AddLocation(context.Selection.SyntaxNode);
+ .SetMessage("The current user is not authorized to access this resource.")
+ .SetCode(ErrorCodes.Authentication.NotAuthorized);
61
62
if (ex != default)
63
64
errorBuilder.SetException(ex);
65
}
66
+ context.ContextData[WellKnownContextData.HttpStatusCode] = 401;
67
context.Result = errorBuilder.Build();
68
69
0 commit comments