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

Allow event data/metadata to be stored as JSON array through HTTP API #1580

Merged
merged 1 commit into from Mar 28, 2018

Conversation

shaan1337
Copy link
Member

Sending an event with data/metadata as JSON array through the HTTP API does not work, it results in an empty string:

curl -i -d @event.txt -H "Content-Type:application/vnd.eventstore.events+json" "http://127.0.0.1:2113/streams/stream"

event.txt:

[
  {
    "eventId": "fbf4a1a1-b4a3-4dfe-a01f-ec52c34e1717",
    "eventType": "event",
    "data": [{"a":1},{"b":2}],
    "metadata": [{"c":3},{"d":4}]
  }
]

However, JSON arrays work fine with .NET API:

_conn.AppendToStreamAsync(
    "stream",ExpectedVersion.Any,
    new EventData[]{
        new EventData(
            Guid.NewGuid(),
            "type",
            true,
            Encoding.ASCII.GetBytes("[{},{}]"),
            Encoding.ASCII.GetBytes("[{},{}]"))
    }).Wait();

@shaan1337 shaan1337 changed the title Allow event data/metadata to be stored as JSON array to be stored through HTTP API Allow event data/metadata to be stored as JSON array through HTTP API Mar 26, 2018
@hayley-jean hayley-jean merged commit f7e1b77 into release-v4.1.1 Mar 28, 2018
@hayley-jean hayley-jean deleted the allow-json-array-http-api branch March 28, 2018 08:46
Copy link
Contributor

@avish0694 avish0694 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested before and after the commit, It works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants