Created by: ybelenko
Core team Slim member recommends to apply CORS headers via custom response emitter to also catch any exceptions. Ref: https://github.com/slimphp/Slim/issues/2999#issuecomment-1066839414
Closes #6851 (closed)
Of course I've checked it locally:
* Preparing request to http://phpslim4.test/v2/pet/5
* Current time is 2022-03-22T18:24:37.435Z
* Using libcurl/7.69.1 OpenSSL/1.1.1g zlib/1.2.11 brotli/1.0.7 libidn2/2.1.1 libssh2/1.9.0 nghttp2/1.41.0
* Using default HTTP version
* Enable timeout of 1000000ms
* Enable automatic URL encoding
* Enable SSL validation
* Enable cookie sending with jar of 0 cookies
* Hostname phpslim4.test was found in DNS cache
* Trying 127.0.0.1:80...
* Connected to phpslim4.test (127.0.0.1) port 80 (#27)
> OPTIONS /v2/pet/5 HTTP/1.1
> Host: phpslim4.test
> User-Agent: insomnia/2020.4.0
> Access-Control-Request-Method: DELETE
> Access-Control-Request-Headers: Content-Type,X-PINGOTHER
> Origin: http://localhost
> Accept: */*
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Tue, 22 Mar 2022 18:24:37 GMT
< Server: Apache/2.4.46 (Unix) PHP/7.4.22
< X-Powered-By: PHP/7.4.22
< Access-Control-Allow-Origin: http://localhost
< Access-Control-Allow-Credentials: true
< Vary: Origin
< Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE
< Access-Control-Allow-Headers: authorization, content-type, x-requested-with
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
* Received 5 B chunk
* Connection #27 to host phpslim4.test left intact
cc @jebentier, @dkarlovi, @mandrean, @jfastnacht, @renepardon
PR checklist
-
Read the contribution guidelines. -
Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community. -
Run the following to build the project and update samples: Commit all changed files. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./mvnw clean package ./bin/generate-samples.sh ./bin/utils/export_docs_generators.sh./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH. -
File the PR against the correct branch: master(5.3.0),6.0.x -
If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.