Bug Tracker

Modify

Ticket #11503 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

jqXHR.status and jqXHR.statusText when body is empty

Reported by: jeroen Owned by:
Priority: low Milestone: None
Component: misc Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

I'm developing a REST client based on jQuery. The server often responds with informative status codes (e.g. 404, 400, 302) without sending any content in the body.

When doing an ajax request in jQuery and a server responds without sending any content in the body, the jqXHR.status contains 0. I suppose maybe when the body is empty, the request is not further parsed anymore. But actually the status code is often useful in itself, even when there is no body or error message.

Change History

comment:1 Changed 2 years ago by jeroen

I am sorry, after a long debugging session, it turned out that my server wasn't sending the Access-Control-Allow-Origin header for these responses, which explains why the request blocked. It works fine when the client and server are on the same domain.

comment:2 Changed 2 years ago by sindresorhus

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to misc

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.