On donderdag 10 mei 2018 15:39:21 CEST Matthew Pava wrote:

> Your reference is interesting because it seems to imply that the method
> attribute has to be uppercase.  Maybe the browser translates it to
> uppercase before sending it to the server?

Again, HTML and requests are not strictly related. Requests are made using HTTP 
and yes, 
the browser is responsible for making that request. HTML has four ways of 
instructing the 
browser to make a request:

- A <form> submission
- <a> Hyperlink
- A src property of a resource reference (through img / script / link etc tags)
- A <meta> refresh tag

And yes, HTTP request methods are uppercase:

% telnet localhost 80
....
Escape character is '^]'.
get / http/1.1
HTTP/1.1 400 Bad Request

Now with capitals:
Escape character is '^]'.
GET / HTTP/1.1
Host: localhost

HTTP/1.1 301 Moved Permanently

> But then that doesn't explain
> why I got two different results based on the case of the method attribute.

Lowercase `get` is a common method, for one on all dictionary-like objects in 
Python. But 
the get method isn't implemented on standard Django Request objects[1]. So even 
reading your original message, I couldn't tell you what went wrong. You 
probably 
analyzed the bug wrong as there are a few close but not quite the same things 
in the 
whole stack:

- HTML Form's method attribute
- A view that has a get() method that handles HTTP GET requests
- Django's HttpRequest object
        - It's GET / POST dictionaries
                - Which have a get() method

I've never come accross a browser that accepted only lowercase HTML attributes, 
although it may have been possible in the dark ages of XHTML 1.1 strict mode. 
I'd be 
thoroughly surprised if the only changing the case of the form's method 
attribute from 
`get` to `GET` would change anything. 

> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of Melvyn Sopacua Sent: Wednesday, May 9, 2018 6:21 PM
> To: [email protected]
> Subject: Re: Case inconsistency
> 
> On woensdag 9 mei 2018 23:00:06 CEST Matthew Pava wrote:
> > I came across an interesting issue recently.  I had a form with an
> > action set to "GET".  The corresponding view was a
> > django-rest-framework view that was just supposed to allow for GET
> > requests.  However, I couldn't get it to work because drf was
> > expecting lower case names, and it turns out that
> > HTML5 expects a lowercase action set to "get".
> 
> HTML is not your reference (and case insensitive to boot). HTML does not
> make requests, it just specifies how responses are rendered. HTTP makes
> requests: https://tools.ietf.org/html/rfc2616#page-36
> --
> Melvyn Sopacua
> 
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group. To unsubscribe from this group and stop receiving
> emails from it, send an email to [email protected].
> To post to this group, send email to [email protected]. Visit
> this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5432858.BvN9p53GFH%40fritzbo
> ok. For more options, visit https://groups.google.com/d/optout.


-- 
Melvyn Sopacua

--------
[1] https://docs.djangoproject.com/en/2.0/ref/request-response/#methods

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1858851.zjc2zYKdUF%40fritzbook.
For more options, visit https://groups.google.com/d/optout.

Reply via email to