Solved

Why does Safari does not allow trailing space in header value

Posted on 2016-10-02
5
85 Views
Last Modified: 2016-10-16
HI,
I noticed that especially in safari if i made an ajax call say like :

headers : {"dsds" : "asdasdas  "}
As this has a trailing space at the end... This will result in an exception.
What could be the reason for this.. As this is not happening for other browsers ??

Thanks
0
Comment
Question by:Rohit Bajaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 56

Expert Comment

by:Julian Hansen
ID: 41826064
We need a context for this, a link and / or screen shot, a full description of the error and a look at the underlying code.
0
 

Author Comment

by:Rohit Bajaj
ID: 41831191
Hi,
I have attached the screenshot of safari console tab. Here if i give a trailing space at the end of a request header it throws an exception otherwise it just runs fine...
Screen-Shot-2016-10-06-at-11.11.17-A.png
0
 
LVL 56

Expert Comment

by:Julian Hansen
ID: 41831216
Still not enough - we need to see the code.

Sidebar - is the space on the end necessary - why not simply trim it before sending.
0
 

Author Comment

by:Rohit Bajaj
ID: 41843224
Thats the whole code in the screenshot just create an xhr request and add an header with a trailing space at the end... It throws an error this does not happen in chrome.. or firefox...
Yes thats what i am planning to do just trim the space before sending....
Just wanted to know if there is any possible reason why safari has done that  and not chrome...
0
 
LVL 56

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 41843354
This bug report seems to deal with the issue

https://github.com/jquery/jquery/issues/3055

Basically it says that a space should be allowed but that there does appear to be an issue with Safari so for now I would just trim the value.
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question