如何在Camel Rest中验证请求标头

问题描述 投票:0回答:1

我正在尝试构建一个get请求,并且想知道如何验证传入的请求是否在请求中具有强制性标头。我的代码是

rest("/employee").id("get-Heartbeat").produces(JSON_MEDIA_TYPE)
            .get().description("The heartbeat API").outType(Employee.class)
            .responseMessage().code(HttpStatus.OK.toString()).message("Employee data").endResponseMessage()
            .to("bean:EmployeeService?method=getEmployee()");

我想验证的强制性标题是header1,header2,header3。

java apache-camel swagger-codegen spring-camel
1个回答
0
投票

您可以定义Rest DSL中的哪些部分是必需的,然后打开客户端请求验证,然后Camel将为您完成此操作。

在文档中查看更多:https://github.com/apache/camel/blob/master/docs/user-manual/modules/ROOT/pages/rest-dsl.adoc

© www.soinside.com 2019 - 2024. All rights reserved.