Skip to content

Commit 7ac5c27

Browse files
Clément Denistangiel
authored andcommitted
Set CORS-related headers before writing body for flex env support
1 parent 5f73500 commit 7ac5c27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

endpoints-framework/src/main/java/com/google/api/server/spi/handlers/EndpointsMethodHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ public void handle(EndpointsContext context) throws IOException {
111111
serviceName);
112112
ParamReader reader = createRestParamReader(context, serializationConfig);
113113
ResultWriter writer = createResultWriter(context, serializationConfig);
114-
systemService.invokeServiceMethod(service, endpointMethod.getMethod(), reader, writer);
115114
if (request.getHeader(Headers.ORIGIN) != null) {
116115
HttpServletResponse response = context.getResponse();
117116
CorsHandler.allowOrigin(request, response);
118117
CorsHandler.setAccessControlAllowCredentials(response);
119118
}
119+
systemService.invokeServiceMethod(service, endpointMethod.getMethod(), reader, writer);
120120
} catch (Exception e) {
121121
// All exceptions here are unexpected, including the ServiceException that may be thrown by
122122
// the findService call. We return an internal server error and leave the details in the

0 commit comments

Comments
 (0)