0

我正在使用 Spring WebFlux、AWS SDK 2.X、Kotlin 和 DynamoDB 增强客户端。我想返回标题201Location但我得到了一个200. 似乎 AWS 开发工具包弄乱了我的实际ResponseEntity

@RestController
@RequestMapping("/test")
class TestController(
    private val dynamoDbAsyncTable: DynamoDbAsyncTable<TestEntity>
) {
    @PostMapping
    fun save(): Mono<ResponseEntity<Unit>> {
        // This returns 201 as expected
        // return Mono.just("someId").map { ResponseEntity.created(URI.create("/test").build() }
        // This returns 200
        return Mono.fromFuture(dynamoDbAsyncTable.putItem(TestEntity("someId"))).map { ResponseEntity.created(URI.create("/test")).build<Unit>() }
    }
}

我错过了什么吗?提前致谢!

4

0 回答 0