question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for JSON merge-patch

See original GitHub issue

It looks like super agent doesn’t support JSON merge-patches with Content-Type: application/merge-patch+json. When I try to send(...) a JSON value it comes out on the other side empty:

    const req = request(app)
        .patch(url)
        .set("Content-Type", "application/merge-patch+json")
        .send(entity);
        .expect('Content-Type', /json/)
        .expect(200);

To reiterate, on the server side, req.body is actually empty.

I haven’t looked at the code but if I had to guess I’d gues sthat send(..) is doing some conversion stuff depending on what Content-Type is set to, which makes sense, but it would be nice in general if I could turn it off, or specify what the body is concretely to avoid this problem.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
deigacommented, Dec 2, 2018

@t3hmrman I started a PR to address this, but I can’t get a test to reproduce the issue. Could you check if the test I wrote is wrong somehow? https://github.com/visionmedia/superagent/pull/1441

0reactions
t3hmrmancommented, Dec 3, 2018

Just found out it’s a bug feature in body-parser from a ticket in 2015.

My apologies @deiga thanks for looking at this

Read more comments on GitHub >

github_iconTop Results From Across the Web

12 Updating a JSON Document with JSON Merge Patch
JSON Merge Patch is suitable for updating JSON documents that primarily use objects for their structure and do not make use of explicit...
Read more >
json-merge-patch - npm
Implementation of JSON Merge Patch (RFC 7396). ... Start using json-merge-patch in your project by running `npm i json-merge-patch`.
Read more >
JSON Merge Patch - JSON for Modern C++
The library supports JSON Merge Patch (RFC 7386) as a patch format. The merge patch format is primarily intended for use with the...
Read more >
JsonMergePatch support for ASP.NET Core - GitHub
JSON Merge Patch support for ASP.NET Core ; var backendModel = ; var mergePatch = ; var newObject = ; using Morcatko ·...
Read more >
RFC 7386: JSON Merge Patch
RFC 7386 JSON Merge Patch October 2014 Table of Contents 1. Introduction . ... Introduction This specification defines the JSON merge patch document...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found