Skip to content

UseHttpMethodOverride not working in .NET 8.0 RC1 #50815

Closed
@andrewdavey

Description

@andrewdavey

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I'm trying to upgrade a .NET 6 web application to .NET 8 RC1. I have app.UseHttpMethodOverride() to allow client to post with the X-Http-Method-Override header.

I'm getting 405 (Method Not Allowed) responses from the endpoints that are mapping non-POST methods. My code is not getting called at all. It's like the pipeline is failing to use the modified HTTP method to route correctly.

Expected Behavior

My endpoint for a non-POST HTTP method should be called.

Steps To Reproduce

Minimal reproduction:

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.UseHttpMethodOverride();
app.MapDelete("/", () => "delete");
app.Run();

Run that, then make a request e.g. with powershell:

Invoke-WebRequest -Uri http://localhost:5070/ -Method POST -Headers @{ 'X-Http-Method-Override' = 'DELETE' }

Exceptions (if any)

No response

.NET Version

8.0.100-rc.1.23463.5

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions