use of com.aliyuncs.fc.exceptions.ClientException in project fc-java-sdk by aliyun.
the class ResponseFactory method genInvokeFunctionResponse.
public static InvokeFunctionResponse genInvokeFunctionResponse(HttpResponse response) throws ClientException, ServerException {
InvokeFunctionResponse invokeFunctionResponse = new InvokeFunctionResponse();
invokeFunctionResponse.setContent(response.getContent());
invokeFunctionResponse.setPayload(response.getContent());
invokeFunctionResponse.setHeaders(response.getHeaders());
invokeFunctionResponse.setStatus(response.getStatus());
Map<String, String> headers = response.getHeaders();
if (headers != null && headers.containsKey(HeaderKeys.INVOCATION_LOG_RESULT)) {
try {
String logResult = Base64Helper.decode(headers.get(HeaderKeys.INVOCATION_LOG_RESULT), Const.DEFAULT_CHARSET);
invokeFunctionResponse.setLogResult(logResult);
} catch (IOException e) {
throw new ClientException(e);
}
}
return invokeFunctionResponse;
}
Aggregations