meros: Unable to parse json with boundary symbols in the response

I’m using meros with relay for the @defer feature and by a coincidence we got exactly --- symbols in a particular field of received json, which leads to a parse error, because part.json is false.

Of course we can just remove these symbols from the data, but maybe there is a better way to handle it in the library?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Ive released 1.2.0 as stable πŸŽ‰, that contains the fixes outlined in this chatter. Hopefully that lines it up with our MS/C# is composing messages.

You shouldnt worry about that, if you JSON encode you will never collide with a boundary coz \r\n---\r\n is encoded away with json, like '"\\r\\n---\\r\\n"' (note the double slashes)

Thank you so much!! πŸ™πŸ»

Ill check this asap, it is Christmas and have a stack of life events to attend this next few days, but 100% will check/fix this before the new year.

@maraisr here is the example quite similar to our app https://github.com/ch1ffa/react-location-relay

There is one @defer fragment which works on the version 1.1.4, and if you change bio to --- and reload the page, you can see an error. For the version 1.2.0-next.3 no data is shown because the first part in parts is missing

Unfortunately, the same behaviour as for the custom build. The first part I see in a loop part of parts is the second chunk that contains β€œlabel”. Maybe I should create an example to reproduce both issues

@maraisr Yeah, sure, let me check. And thank you for such a quick response!

Small update, was able to reproduce the bug with your example! πŸ™πŸ» working on a solution.

Hi @maraisr

Indeed, it’s from HC backend.

Our message contains something like that:

{"__typename":"tDO","desc":"---","cdc":"SPS"}