• Post Reply Bookmark Topic Watch Topic
  • New Topic

HF book pg133 ~ setHeader("content-type")

 
Lee Kian Giap
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In page133 , it mentioned that response.setHeader("content-type","text/html"); has no difference with response.setContentType("text/html");

As I refer to Chapter 1 , the content-type header in HTTP Response is "Content-Type", I mean it comes with Uppercase "C" and "T".

So, my question is response.setHeader("content-type","text/html"); will create a "content-type" header instead of "Content-Type" header in HTTP Response , may I know whether the HTTP Response header case sensitive when the web browser read it ?

Thank you !!!
 
Ankit Garg
Sheriff
Posts: 9597
36
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think HTTP headers are case sensitive. So content-type is the same as Content-Type...
 
Milton Ochoa
Ranch Hand
Posts: 336
Firefox Browser Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am agree with Ankit
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!