[wp-trac] [WordPress Trac] #28919: WP_Http needs to support custom HTTP status code messages
WordPress Trac
noreply at wordpress.org
Wed Jul 16 10:16:26 UTC 2014
#28919: WP_Http needs to support custom HTTP status code messages
-------------------------+-----------------------------
Reporter: ragulka | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTTP API | Version: 3.9.1
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
WP_Http has currently no way to get the the status message for a custom
HTTP status code, because it uses `get_status_header_desc` to map the
status code to a built-in status message. This provides a problem when
interacting with APIs that use custom HTTP status codes for error
messages, for example, because there is no way to know the error message.
I suggest there be a filter around
https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes/class-
http.php#L1402 so it's possible for developers to supply their own status
message. Something like:
{{{
$response['message'] = apply_filters( 'http_status_header_description',
get_status_header_desc($response['code']), $response['code'], $response );
}}}
Providing the response code and full response array would allow developers
to see the full context when filtering.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28919>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list