Skip to content

API_Framework headers not set on HTTP requests that aren't GET #26

@pointybeard

Description

@pointybeard

The API_Framework controller event short circuits page rendering with the following code in it's load() method:

$response->send();
exit;

This means that the custom headers like X-API-Framework-Render-Time aren't added like they are with a GET request. Also, the delegate(s) APIFrameworkJSONRendererAppendTransformations and JsonFrontendPreRenderHeaders are never triggered.

It would be nice if the render pipeline for both controller driven and non-controller driven requests (i.e. GET vs POST/PUT/PATCH/DELETE) ends in the same place to allow the same headers to be added and delegates to be triggered. If this isn't possible, at the very least, a new delegate should be added before the controller events send the response. E.g.

    /*
     * This is just prior to the page headers being re-rendered
     * @delegate JsonFrontendPreRenderHeaders_ControllerEvent
     * @param string $context
     * '/json_frontend/'
     */
    \Symphony::ExtensionManager()->notifyMembers(
        'JsonFrontendPreRenderHeaders_ControllerEvent',
        '/json_frontend/',
        ["response" => &$response]
    );

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions