Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HEAD requests should not echo the response #40

Closed
logistiker opened this issue Jul 28, 2011 · 1 comment
Closed

HEAD requests should not echo the response #40

logistiker opened this issue Jul 28, 2011 · 1 comment

Comments

@logistiker
Copy link

Although I could set the body to null for head requests, I think this should really be handled by tonic. The echo should not even be called for a HEAD request.

/**
 * Output the response
 * @codeCoverageIgnore
 */
function output() {

    if (php_sapi_name() != 'cli' && !headers_sent()) {

        header('HTTP/1.1 '.$this->code);
        foreach ($this->headers as $header => $value) {
            header($header.': '.$value);
        }
    }
    if (strtoupper($this->request->method) !== 'HEAD') {
        echo $this->body;
    }

}
@peej
Copy link
Owner

peej commented Aug 2, 2011

Although it adds a special case for a single method, HEAD is a special case so I don't see this as a problem. Thanks.

@peej peej closed this as completed Aug 2, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants