This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27846 - Disallow request body when method is HEAD/GET
Summary: Disallow request body when method is HEAD/GET
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: Fetch (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+fetchspec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-16 19:10 UTC by Nikhil
Modified: 2015-01-17 09:24 UTC (History)
1 user (show)

See Also:


Attachments

Description Nikhil 2015-01-16 19:10:37 UTC
XHR explicitly prohibits it. Fetch should do so too [1]

[1] http://logs.glob.uno/?c=content#c259373
Comment 1 Nikhil 2015-01-16 21:19:10 UTC
On further discussion [1], the Request constructor should throw an exception if such an attempt is made. For now Gecko is going to implement [2] something like:



If init's body member is present, run these substeps:

    **If request's normalized method is GET or HEAD, throw a TypeError.**

    Let stream and Content-Type be the result of extracting init's body member.

    Set r's request's body to stream.

    If Content-Type is non-null and r's request's header list contains no header named `Content-Type`, append `Content-Type`/Content-Type to r's Headers object. Rethrow any exception. 

[1] http://logs.glob.uno/?c=content#c259382
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1122677