【发布时间】:2026-01-30 17:05:01
【问题描述】:
我有一个这样定义的普通 http 路由
delete {
handleErrorsAndReport("delete_foo") {
fooRepository.deleteFoo(fooId)
complete(NoContent)
}
}
我想为其添加一些基本身份验证,所以现在看起来像
seal(
authenticateBasic(
realm = "Secure foo",
scopeAuthenticator
) { scopes =>
delete {
handleErrorsAndReport("delete_foo") {
fooRepository.deleteFoo(fooId, scopes)
complete(NoContent)
}
}
}
)
完整的指令是
concat(
get {
// something else which is working
},
seal(
// something else which is working
),
seal(
authenticateBasic(
realm = "Secure foo",
scopeAuthenticator
) { scopes =>
delete {
handleErrorsAndReport("delete_foo") {
fooRepository.deleteFoo(fooId, scopes)
complete(NoContent)
}
}
}
)
)
现在我在尝试删除 foos 时遇到以下异常
Request DELETE http://builder/foos/fooId failed with response code 405 due to request error. Response body: HTTP method not allowed, supported methods: PUT
可能是什么问题?我使用 API 的方式没有改变,但恐怕随着 seal 指令的引入而发生了一些变化。
【问题讨论】: