Questions tagged [httprequest]

HTTP Request is a message within a request/response sequence, according to HTTP specification. May also refer an HttpRequest class in software frameworks and libraries that automates relevant functionality

From W3C specification:

A request message from a client to a server includes, within the first line of that message, the method to be applied to the resource, the identifier of the resource, and the protocol version in use.

    Request       = Request-Line              ;
                    *(( general-header        ;
                     | request-header         ;
                     | entity-header ) CRLF)  ;
                    CRLF
                    [ message-body ]          ;

See also:

7773 questions
227
votes
13 answers

HTTP GET Request in Node.js Express

How can I make an HTTP request from within Node.js or Express.js? I need to connect to another service. I am hoping the call is asynchronous and that the callback contains the remote server's response.
Travis Parks
  • 8,435
  • 12
  • 52
  • 85
224
votes
9 answers

Request Monitoring in Chrome

In Firefox, I use Firebug which allows me to view every http request my ajax calls are making. I've switched over my development to Chrome and am liking it so far. My only complaint, however, is that the developer tools don't seem to allow you to…
Wes P
  • 9,622
  • 14
  • 41
  • 48
223
votes
13 answers

Asynchronous Requests with Python requests

I tried the sample provided within the documentation of the requests library for python. With async.map(rs), I get the response codes, but I want to get the content of each page requested. This, for example, does not work: out = async.map(rs) print…
trbck
  • 5,187
  • 6
  • 26
  • 29
200
votes
12 answers

How can I get the baseurl of site?

I want to write a little helper method which returns the base URL of the site. This is what I came up with: public static string GetSiteUrl() { string url = string.Empty; HttpRequest request = HttpContext.Current.Request; if…
Jaggu
  • 6,298
  • 16
  • 58
  • 96
187
votes
17 answers

Microsoft CDN for jQuery or Google CDN?

Does it actually matter which CDN you use to link to your jquery file or any javascript file for that matter. Is one potentially faster than the other? What other factors could play a role in which cdn you decide to use? I know that Microsoft,…
Xaisoft
  • 45,655
  • 87
  • 279
  • 432
178
votes
13 answers

How to extract custom header value in Web API message handler?

I currently have a message handler in my Web API service that overrides 'SendAsync' as follows: protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { //implementation } Within…
atconway
  • 20,624
  • 30
  • 159
  • 229
171
votes
10 answers

Adding header to all request with Retrofit 2

Retrofit 2's documentation says: Headers that need to be added to every request can be specified using an OkHttp interceptor. It can be done easily using the previous version, here's the related QA. But using retrofit 2, I couldn't find something…
Ashkan Sarlak
  • 7,124
  • 6
  • 39
  • 51
161
votes
10 answers

How to use HttpWebRequest (.NET) asynchronously?

How can I use HttpWebRequest (.NET, C#) asynchronously?
Jason
  • 16,739
  • 23
  • 87
  • 137
144
votes
2 answers

Python Requests package: Handling xml response

I like very much the requests package and its comfortable way to handle JSON responses. Unfortunately, I did not understand if I can also process XML responses. Has anybody experience how to handle XML responses with the requests package? Is it…
Andy
  • 9,483
  • 12
  • 38
  • 39
142
votes
5 answers

Usage of EnsureSuccessStatusCode and handling of HttpRequestException it throws

What's the usage pattern of HttpResponseMessage.EnsureSuccessStatusCode()? It disposes of the Content of the message and throws HttpRequestException, but I fail to see how to programmatically handle it any differently than a generic Exception. For…
G. Stoynev
  • 7,389
  • 6
  • 38
  • 49
141
votes
10 answers

How can I get all the request headers in Django?

I need to get all the Django request headers. From what I've read, Django simply dumps everything into the request.META variable along with a lot of other data. What would be the best way to get all the headers that the client sent to my Django…
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
140
votes
4 answers

ASP.NET MVC: Is Controller created for every request?

Very simple question: Are controllers in ASP.NET created for every HTTP request, or are they created at application startup and reused throughout requests? Will the controller be created only for a particular HTTP request? If my previous assumptions…
Rasto
  • 17,204
  • 47
  • 154
  • 245
139
votes
10 answers

How to get HTTP Response Code using Selenium WebDriver

I have written tests with Selenium2/WebDriver and want to test if HTTP Request returns an HTTP 403 Forbidden. Is it possible to get the HTTP response status code with Selenium WebDriver?
Ralph
  • 118,862
  • 56
  • 287
  • 383
128
votes
4 answers

Spring 3 MVC accessing HttpRequest from controller

I would like to handle request and session attributes myself rather then leave it to spring @SessionAttributes, for login of cookies handling for example. I just cant figure out how could I access the HttpRequest from within a controller, I need a…
JBoy
  • 5,398
  • 13
  • 61
  • 101
124
votes
7 answers

What's the best way to get the current URL in Spring MVC?

I'd like to create URLs based on the URL used by the client for the active request. Is there anything smarter than taking the current HttpServletRequest object and it's getParameter...() methods to rebuilt the complete URL including (and only) it's…
Koraktor
  • 41,357
  • 10
  • 69
  • 99