File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Release Notes for Element API
22
3+ ## 2.8.3 - 2021-09-25
4+
5+ ### Fixed
6+ - Fixed a bug where endpoint callables weren’t getting called for ` OPTIONS ` requests. ([ #156 ] ( https://github.com/craftcms/element-api/issues/156 ) )
7+
38## 2.8.2 - 2021-09-03
49
510### Fixed
Original file line number Diff line number Diff line change 11{
22 "name" : " craftcms/element-api" ,
33 "description" : " Create a JSON API for your elements in Craft" ,
4- "version" : " 2.8.2 " ,
4+ "version" : " 2.8.3 " ,
55 "type" : " craft-plugin" ,
66 "keywords" : [
77 " api" ,
Original file line number Diff line number Diff line change @@ -56,11 +56,6 @@ class DefaultController extends Controller
5656 */
5757 public function actionIndex (string $ pattern ): Response
5858 {
59- if ($ this ->request ->getIsOptions ()) {
60- $ this ->response ->format = Response::FORMAT_RAW ;
61- return $ this ->response ;
62- }
63-
6459 $ callback = null ;
6560 $ jsonOptions = null ;
6661 $ pretty = false ;
@@ -79,6 +74,12 @@ public function actionIndex(string $pattern): Response
7974 $ config = $ this ->_callWithParams ($ config , $ params );
8075 }
8176
77+ if ($ this ->request ->getIsOptions ()) {
78+ // Now that the endpoint has had a chance to add CORS response headers, end the request
79+ $ this ->response ->format = Response::FORMAT_RAW ;
80+ return $ this ->response ;
81+ }
82+
8283 if (is_array ($ config )) {
8384 // Merge in the defaults
8485 $ config = array_merge ($ plugin ->getDefaultResourceAdapterConfig (), $ config );
You can’t perform that action at this time.
0 commit comments