Skip to content

set_status_header, and send_ajax_response no longer working with 422 after upgrading from 6 to 7 #4974

@benjivm

Description

@benjivm

My addon has the following lines, working fine on EE 6:

$http = (new Http())
     ->withOptions(['base_uri' => ee('Config')->get('my_api').'/'])
     ->withToken(ee('Config')->get('my_token'))
     ->acceptJson();

$response = $http->post($endpoint, $data);

ee()->output->set_status_header($response->status(), $response->reason());
ee()->output->send_ajax_response($response->json(), $response->status());

Now, if the status code is 422, I receive the following on the frontend:

{
	"error": "No status text available.  Please check your status code number or supply your own message text."
}

Changing the status code to anything else works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions