request-headers

Basic Authentication using jQuery/ajax

廉价感情. 提交于 2019-12-23 10:01:04
问题 I am trying to create basic authentication page where my form has three fields username password grant type On submitting a form I just want to display returned response from a server on my HTML in JSON format. My AJAX call to web service also requires Authorization header to be set. But somehow headers are not getting set. I am trying beforeSend : function(xhr) { xhr.setRequestHeader('Authorization', "Basic ******"); xhr.setRequestHeader("contentType", "application/json;charset=UTF-8"); }

HTTPS header issue with Chrome version 44.0.2403.xx

独自空忆成欢 提交于 2019-12-22 05:54:28
问题 I have been struggling since I have installed the new Chrome version 44.0.2403.xx. My initial issue was that some stylesheet on my website were load over https, but my website is only http. I use wordpress, so I have searched inside the core function to find where the HTTPS was added into the url. The culprit is the is_ssl() function. Wordpress base is HTTPS verification over the $_SERVER['HTTPS'] variable, and mine was set to 1. I found out that the last Google Chrome version is sending a

What's the best way to set custom request headers when using Capybara in RSpec request specs?

大憨熊 提交于 2019-12-21 04:26:18
问题 I'm monkey patching Capybara::Session with a set_headers method that assigns to Capybara::RackTest::Browser's options attribute (which I've changed from an attr_reader to an attr_accessor). The patches: class Capybara::RackTest::Browser attr_accessor :options end class Capybara::Session def set_headers(headers) if driver.browser.respond_to?(:options=) #because we've monkey patched it above options = driver.browser.options if options.nil? || options[:headers].nil? options ||= {} options[

REST API - Use the “Accept: application/json” HTTP Header

怎甘沉沦 提交于 2019-12-17 18:46:39
问题 When I make a request, I get a response in XML, but what I need is JSON. In the doc it is stated in order to get a JSON in return: Use the Accept: application/json HTTP Header. Where do I find the HTTP Header to put Accept: application/json inside? My guess is it is not suppose to be inside the URL-request, which looks like: http://localhost:8080/otp/routers/default/plan?fromPlace=52.5895,13.2836&toPlace=52.5461,13.3588&date=2017/04/04&time=12:00:00 回答1: You guessed right, HTTP Headers are

Firefox does not honor Content-type header in xhrPost

社会主义新天地 提交于 2019-12-10 15:20:33
问题 I am trying to post a json string to a REST service. The following code is being used: dojo.xhrPost( { url: REST_URL, postData: jsonData, handleAs: "json", headers: {"Content-Type": "application/json"}, load: function(response, ioArgs) { alert(response); }, error: function(response, ioArgs) { alert(response); } }); I intercept the requests sent by the browsers (IE/Firefox) using fiddler. When I submit the request from IE, fiddler shows the Content-type header being set to "application/json".

R: fetching pdf documents from Companies House API

折月煮酒 提交于 2019-12-10 03:06:08
问题 I'm trying to fetch documents from the API using R. Appreciate the clarification of the process in this post. I've been following the above steps with partial success, but still fail the last step to get access to documents' content: Find the document filing you're interested in (e.g. make a filing history request1 for the company). Parse the response for the link to the document in the field "links" : { "document_metadata" : "link URI fragment here" }. No problem: library(httr) library

Where to add CORS headers in AWS EC2

北城余情 提交于 2019-12-08 12:20:59
问题 I'm making a POST request from a browser to my EC2 AWS server but getting the following error back. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.example.com' is therefore not allowed access. The response had HTTP status code 401. I've done some research and release I need to enable CORS on my EC2 AWS server - I understand that I should be adding something along the lines of <CORSConfiguration> <CORSRule> <AllowedOrigin>http://www.example1

Can two http request come together? If it can, how nodeJS server handles it?

▼魔方 西西 提交于 2019-12-08 05:47:01
问题 Yesterday I was giving some presentation on nodeJS. Some one asked me following question: As we know nodeJS is a single threaded server, several request is coming to the server and it pushes all request to event loop. What if two request is coming to server at exact same time, how server will handle this situation? I guessed a thought and replied back following: I guess No two http request can come to the server at exact same time , all request come through a single socket so they will be in

R: fetching pdf documents from Companies House API

旧时模样 提交于 2019-12-05 02:51:14
I'm trying to fetch documents from the API using R. Appreciate the clarification of the process in this post . I've been following the above steps with partial success, but still fail the last step to get access to documents' content: Find the document filing you're interested in (e.g. make a filing history request1 for the company). Parse the response for the link to the document in the field "links" : { "document_metadata" : "link URI fragment here" }. No problem: library(httr) library(jsonlite) library(openssl) ### retrieving filing history #### company_num = 'FC013908' key = 'my_key' fh

Add request headers with WebClient C#

蓝咒 提交于 2019-12-04 12:14:25
问题 I have the following code with which I download a web-page into a byte array and then print it with Response.Write: WebClient client = new WebClient(); byte[] data = client.DownloadData(requestUri); /*********** Init response headers ********/ WebHeaderCollection responseHeaders = client.ResponseHeaders; for (int i = 0; i < responseHeaders.Count; i++) { Response.Headers.Add(responseHeaders.GetKey(i), responseHeaders[i]); } /***************************************************/ Besides of the