Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest: message decoding #97

Closed
ricardopereira opened this issue Dec 1, 2015 · 5 comments
Closed

Rest: message decoding #97

ricardopereira opened this issue Dec 1, 2015 · 5 comments
Labels
bug Something isn't working. It's clear that this does need to be fixed.

Comments

@ricardopereira
Copy link
Contributor

I have a dictionary and I publish it like:

dictionary: NSDictionary = @{ name = "John"; number = 3; }

channel.publish(dictionary)

and the lib sends it like (dictionary -> binary -> base64):

{
  "data": "eyJudW1iZXIiOjMsIm5hbWUiOiJKb2huIn0=",
  "encoding": "json/base64"
}
               ^~~~~~~~~~ bug?

I was expecting a different payload, something like (dictionary -> json):

{
  "data": {
    "name": "John",
    "number": 3
  },
  "encoding": "json"
}

The same happens with NSArray.

References

(RSL4d3) a JSON Message payload is stringified either as a JSON Object or Array and represented as a JSON string and the encoding attribute is set to “json”

(RSL4d4) All messages received will be decoded based on the encoding field and deliver payloads in the format they were sent in i.e. binary, string, or a structured type containing the parsed JSON

@ricardopereira ricardopereira added the bug Something isn't working. It's clear that this does need to be fixed. label Dec 1, 2015
@ricardopereira ricardopereira mentioned this issue Jan 6, 2016
Merged
@mattheworiordan
Copy link
Member

Yes, agreed, this should be JSON encoded as opposed to binary encoded.

@ricardopereira
Copy link
Contributor Author

@mattheworiordan Fixed and test done 16448e5

@mattheworiordan
Copy link
Member

Great, is that part of a PR?

@ricardopereira
Copy link
Contributor Author

Yes #96

@ricardopereira
Copy link
Contributor Author

I opened a PR: #122

maratal pushed a commit that referenced this issue Jul 19, 2023
Spec: add G4a, clarifying that protocol version should be treated literally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. It's clear that this does need to be fixed.
Development

No branches or pull requests

2 participants