diegomvh / angular-odata

Client side OData typescript library for Angular
https://www.npmjs.com/package/angular-odata
MIT License
50 stars 14 forks source link

Batch response parsing fails when newlines are defined as '\n' #19

Closed koshdim closed 4 years ago

koshdim commented 4 years ago

I was struggling with inner request in batch callbacks not triggering, after hours of debugging I found the line

handleResponse(response: HttpResponse<any>) {
...
const lines: string[] = response.body.split(NEWLINE);

where NEWLINE is defined as '\r\n' but my service returns just '\n', which seems to be valid as well. please make it either configurable or detect the newline format in handleResponse yourself

diegomvh commented 4 years ago

RFC2616: "The line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR."

ok RFC 👍

thank you @koshdim

diegomvh commented 4 years ago

What about https://github.com/OData/AspNetCoreOData/issues/24#issuecomment-721683490 ?

koshdim commented 4 years ago

@diegomvh yes, that's my case. then the source of this issue is bug in AspNetCoreOData then. Apparently they use this property internally, which changes depending on which system the application runs. thank you for covering up for AspNetCoreOData, I hope you don't remove your recent fix.