as you said,
To make sure this wasn’t the API’s server issue, I replicate the same
query using Node.js (Express and Request libs) and it works every
time. It makes me almost sure is a spray bug.
your code in scala send requests with HTTP pipelining feature, do you send the requests with HTTP pipelining feature while you testing with nodejs?
for error message:
the server doesn’t appear to support request pipelining
you should make sure:
- please make sure that the server support the pipelining feature, and the pipelining feature is enable.
- if there are proxies between your client and server(include reverse proxy), please make sure that the proxies support pipelining feature, and the pipelining feature is enable.
If you can’t make sure the pipelining feature can be supported properly, you should not use it.
following resource may helpful:
HTTP pipelining requires both the client and the server to support it.
HTTP/1.1 conforming servers are required to support pipelining. This
does not mean that servers are required to pipeline responses, but
that they are required not to fail if a client chooses to pipeline
HTTP pipelining is not activated by default in modern browsers:
Buggy proxies are still common and these lead to strange and erratic
behaviors that Web developers cannot foresee and diagnose easily.
Pipelining is complex to implement correctly: the size of the resource
being transferred, the effective RTT that will be used, as well as the
effective bandwidth, have a direct incidence on the improvement
provided by the pipeline. Without knowing these, important messages
may be delayed behind unimportant ones. The notion of important even
evolves during page layout! HTTP pipelining therefore brings a
marginal improvement in most cases only. Pipelining is subject to the
HOL problem. For these reasons, pipelining has been superseded by a
better algorithm, multiplexing, that is used by HTTP/2.