Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Set CORS-related headers before writing body for flex env support#79

Merged
tangiel merged 1 commit intocloudendpoints:masterfrom
AODocs:cors_support_on_flex
Apr 3, 2017
Merged

Set CORS-related headers before writing body for flex env support#79
tangiel merged 1 commit intocloudendpoints:masterfrom
AODocs:cors_support_on_flex

Conversation

@clementdenis
Copy link
Contributor

On flex env, it seems like custom headers set on the response after writing to the body are not always being written to the final http response.
This causes CORS support not to work with Cloud Endpints v2 on flex env (it works fine on AppEngine standard though).

Simply changing the code to write CORS headers before the response body fixes the issue.
Additionally, it makes any backend error that would happen available to CORS clients as well.

@codecov-io
Copy link

Codecov Report

Merging #79 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master     #79   +/-   ##
========================================
  Coverage      79.4%   79.4%           
  Complexity     1618    1618           
========================================
  Files           154     154           
  Lines          5449    5449           
  Branches        702     702           
========================================
  Hits           4327    4327           
  Misses          848     848           
  Partials        274     274
Impacted Files Coverage Δ Complexity Δ
...pi/server/spi/handlers/EndpointsMethodHandler.java 100% <100%> (ø) 10 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f73500...6c75b96. Read the comment docs.

@tangiel tangiel merged commit 7ac5c27 into cloudendpoints:master Apr 3, 2017
@clementdenis clementdenis deleted the cors_support_on_flex branch July 31, 2018 12:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants