Improve option handling and fix format handling in the API#39498
Improve option handling and fix format handling in the API#39498roland-d merged 4 commits intojoomla:4.2-devfrom
Conversation
|
I have tested this item ✅ successfully on 83ac935 Just note that if you have To fix that, the plugin needs to have the following in its onBeforeApiRoute handler (where routes are registered): $this->getApplication()->addFormatMap('application/ld+json', 'jsonld');Since this is the expected behaviour of ApiApplication I consider my test successful. Thank you, George! This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39498. |
|
I re-read my test description and it's… unclear. What I meant to say is that if you do not follow George's instruction to use I'm gonna go get some coffee now. |
|
I have tested this item ✅ successfully on 83ac935 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39498. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39498. |
|
Thank you |
Pull Request for Issue #39495 .
Summary of Changes
Fixes linked bug
Testing Instructions
In a webservice plugin (either custom or in a core one in the core add the following lines to the
onBeforeApiRouteevent (i used the content webservice plugin - but any will do)Then in the libraries/src/Application/ApiApplication.php add var_dump($this->input->get('format'), $this->input->get('option'));die; after this foreach loop (both before and after testing)
Generate a Bearer token and curl the url e.g.
curl -H "Authentication: Bearer <bearer_token>" -H "Accept: application/ld+json" http://localhost/joomla-cms/api/index.php/v1/formatActual result BEFORE applying this Pull Request
Expected result AFTER applying this Pull Request
i.e. the second dump (the component) is unchanged and the former (the format) now contains the Joomla format and not the array of possible options from the plugin
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed