Skip to content

Commit 96b63cb

Browse files
authored
Fix parity between HTTP and gRPC pub/sub (#443)
* Add client tests and framework Signed-off-by: Shubham Sharma <[email protected]> * WIP: HTTP basic fixes Signed-off-by: Shubham Sharma <[email protected]> * WIP: gRPC basic fixes Signed-off-by: Shubham Sharma <[email protected]> * Things finally just work, still WIP Signed-off-by: Shubham Sharma <[email protected]> * WIP: test migration Signed-off-by: Shubham Sharma <[email protected]> * Finish tests migration Signed-off-by: Shubham Sharma <[email protected]> * Prettify Signed-off-by: Shubham Sharma <[email protected]> * Refactor Signed-off-by: Shubham Sharma <[email protected]> * Fix build Signed-off-by: Shubham Sharma <[email protected]> * Final fix for tests Signed-off-by: Shubham Sharma <[email protected]> * Prettify Signed-off-by: Shubham Sharma <[email protected]> * Refactor and add unit tests Signed-off-by: Shubham Sharma <[email protected]> * Add changelog Signed-off-by: Shubham Sharma <[email protected]> * Apply nits Signed-off-by: Shubham Sharma <[email protected]> * Apply nits Signed-off-by: Shubham Sharma <[email protected]> * Add unit test Signed-off-by: Shubham Sharma <[email protected]> * Refactor test Signed-off-by: Shubham Sharma <[email protected]> * Prettify Signed-off-by: Shubham Sharma <[email protected]> * Add more tests Signed-off-by: Shubham Sharma <[email protected]> * Prettify Signed-off-by: Shubham Sharma <[email protected]> * Add more tests Signed-off-by: Shubham Sharma <[email protected]> --------- Signed-off-by: Shubham Sharma <[email protected]>
1 parent 97cd66e commit 96b63cb

File tree

20 files changed

+1766
-943
lines changed

20 files changed

+1766
-943
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66

77
#### Breaking Changes
88

9-
##### GENERAL: Serialization changed and data is correctly being serialized now
9+
##### General: Fix serialization of data in HTTP
1010

11-
Previously when sending data, it could happen that it was incorrectly serialized. This has been resolved and a new serializer is in place that will automatically detect the Content-Type for the data when using the HTTP Protocol and serialize accordingly. Objects will be send as `application/json`, Cloud-Events as `applications/cloudevents+json`, Strings as `text/plain`, and others as `application/octet-stream`.
11+
There is a new serializer in place to automatically detect the Content-Type for the data when using the HTTP Protocol and serialize accordingly. Objects will be send as `application/json`, Cloud-Events as `applications/cloudevents+json`, Strings as `text/plain`, and others as `application/octet-stream`.
1212

13-
As an example, when performing `client.invoke` with `"hello world"` as data instead of an object, the `JSON.serialize` method would be called and we would receive `'"hello world"'` (notice the `'`). Now due to the new serializer we will correctly return the string type.
13+
An example of this change can be seen when performing client.invoke with `"hello world"` as data. The new serializer will correctly return the string type, as opposed to the previous behavior of calling `JSON.serialize` and returning `'"hello world"'`.
14+
15+
##### PubSub: Changes to the subscribe callback for HTTP
16+
17+
The HTTP subscribe callback now returns data after parsing it correctly. Data is either extracted from the body's `data` field, or the `data_base64` field. `data_base64` is always expected to be a base64 encoded string, and will be decoded and parsed as JSON if possible. If it is not JSON, it will be returned as a string. If data is not found in either field, the entire body will be returned as-is.
1418

1519
## 2.x release
1620

0 commit comments

Comments
 (0)