Bug Tracker

Modify

Ticket #6462 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

MERGE HTTP verb does not submit options.data in an ajax call

Reported by: neo98052 Owned by:
Priority: undecided Milestone:
Component: ajax Version: 1.4.2
Keywords: OData MERGE ajax Cc:
Blocking: Blocked by:

Description

The MERGE HTTP keyword does not currently submit the payload (options.data) in the call to the ajax method. The OData protocol uses both the PUT and MERGE keywords to enable updating of data.

The issue is on line 5256:

xhr.send(type === "POST"
type === "PUT" type === "DELETE" ? s.data : null);

If an additional check is added for type === "MERGE", it will enable the scenario.

Change History

comment:1 Changed 3 years ago by dmethvin

  • Component changed from unfiled to ajax

comment:2 Changed 3 years ago by anonymous

Odata docs suggest using POST with the .ajax method and sending the MERGE verb via the X-HTTP-Method header. Here is a link with sample jquery code:  http://social.msdn.microsoft.com/Forums/en/adodotnetdataservices/thread/e2fedabb-ed38-4b68-bb75-1fcfc9808267

comment:3 Changed 3 years ago by neo98052

OData provides this functionality in order to support clients that don't support all of the verbs. However, it requires clients to always implement the beforeSend callback in order to attach the header. As this is the only OData HTTP verb that jQuery does not support, it would be useful if it did fully support it.

comment:4 Changed 3 years ago by snover

  • Keywords needsreview added
  • Priority set to undecided
  • Milestone 1.4.2 deleted

MERGE is not a valid HTTP/1.1 verb, so I am not sure why jQuery should go out of its way to support it.

comment:5 Changed 3 years ago by snover

#6612 is a duplicate of this ticket.

comment:6 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in jQuery 1.4.3; GET and HEAD requests have their .data property serialized to the URL, but all other verbs send the data as the entity body.

comment:7 Changed 3 years ago by dmethvin

  • Keywords needsreview removed

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.