Search in sources :

Example 1 with LocalRestServerRequest

use of io.servicecomb.common.rest.codec.LocalRestServerRequest in project java-chassis by ServiceComb.

the class CseClientHttpRequest method collectArguments.

private Object[] collectArguments(RequestMeta requestMeta, Map<String, List<String>> queryParams) {
    RestServerRequest mockRequest = new LocalRestServerRequest(requestMeta.getPathParams(), queryParams, httpHeaders, requestBody);
    List<RestParam> paramList = requestMeta.getSwaggerRestOperation().getParamList();
    Object[] args = new Object[paramList.size()];
    for (int idx = 0; idx < paramList.size(); idx++) {
        RestParam param = paramList.get(idx);
        try {
            args[idx] = param.getParamProcessor().getValue(mockRequest);
        } catch (Exception e) {
            LOGGER.error("error arguments for operation " + requestMeta.getOperationMeta().getMicroserviceQualifiedName(), e);
            throw new Error(e);
        }
    }
    return args;
}
Also used : LocalRestServerRequest(io.servicecomb.common.rest.codec.LocalRestServerRequest) LocalRestServerRequest(io.servicecomb.common.rest.codec.LocalRestServerRequest) RestServerRequest(io.servicecomb.common.rest.codec.RestServerRequest) IOException(java.io.IOException) RestParam(io.servicecomb.common.rest.definition.RestParam)

Aggregations

LocalRestServerRequest (io.servicecomb.common.rest.codec.LocalRestServerRequest)1 RestServerRequest (io.servicecomb.common.rest.codec.RestServerRequest)1 RestParam (io.servicecomb.common.rest.definition.RestParam)1 IOException (java.io.IOException)1