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

POST'ing application/xml returning "HTTP/1.1 400 Write request body invalid." for valid xml #908

Closed
firehooper opened this issue Apr 30, 2016 · 5 comments
Labels
kind/bug Issues which are a software defect

Comments

@firehooper
Copy link

There seems to be a difference between:

Using application/vnd.eventstore.events+xml" with ES body specifing ES-EventType and ES-EventId
and
application/xml with headers specifing ES-EventType and ES-EventId

text/xml posts, but read side does not embed body.

application/xml returns "HTTP/1.1 400 Write request body invalid." for valid xml.

Reproducer:
echo "<foo>abc</foo>" | curl -i -H "ES-EventType: SomeEvent" -H "ES-EventId: C322E299-CB73-4B47-97C5-5054F9207461" -H "Content-Type: application/xml" -d @- http://127.0.0.1:2113/streams/newstream

See: https://groups.google.com/forum/#!topic/event-store/-DzbjtuqQF0

@gregoryyoung
Copy link
Contributor

https://github.com/EventStore/EventStore/blob/release-v3.7.0/src/EventStore.Core/Services/Transport/Http/AutoEventConverter.cs#L87

Is the culprit. Note text/xml is handled differently than application/xml. application/xml is getting processed as events+xml (should be moved up with text/xml) and my guess is the content type isn't getting set on the text/xml which is why it isn't showing up though not 100% positive on this part.

I would just fix now but also needs some tests around this and don't have the time at the moment.

@gregoryyoung
Copy link
Contributor

I took care of the first part. Need to look more. Does TryHarder include it instead of body?

We should be on this during the week and likely will point release a fix.

Cheers,

Greg

@firehooper
Copy link
Author

Thanks. When reading a POST'ed text/xml event using: http http://127.0.0.1:2113/streams/newstream/0?embed=TryHarder "Accept:application/atom+xml" does not include the data of the event (raw or parsed).
Although http http://127.0.0.1:2113/streams/newstream/0?embed=TryHarder "Accept:application/vnd.eventstore.atom+json" does return the raw xml string under "data".

@pgermishuys
Copy link
Contributor

pgermishuys commented May 2, 2016

Currently embed is only supported in json (as stated in the documentation here http://docs.geteventstore.com/http-api/3.6.0/reading-streams), that being said there is an issue when posting/reading xml that will be looked at.

@pgermishuys pgermishuys added the kind/bug Issues which are a software defect label May 2, 2016
@hayley-jean hayley-jean added this to the v4.0.0 milestone Aug 11, 2016
@pgermishuys pgermishuys removed this from the v4.0.0 milestone Apr 4, 2017
@pgermishuys
Copy link
Contributor

Closing this due to age, please reopen if you are still facing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues which are a software defect
Projects
None yet
Development

No branches or pull requests

4 participants