Open lmb-djaquier opened 10 months ago
A FlurlRequest should never be reused. Much like the HttpRequestMessage that it effectively wraps, it's underpinned by a forward-only stream. The rules mirror those of the HttpClient stack: reuse clients heavily; never reuse requests. Your fix of creating a new one is correct.
Ah ok, explained like that it makes sense.
With the fluent interface it's actually not that visible that a request is created:
var jiraAddAttachmentUrl = jiraCreateIssueResponse.Self .AppendPathSegment("attachments"); or url.WithHeader("Accept", "text/plain")
One might be tempted to reuse a request.
Might be helpful to add this information to the documentation or maybe even throw an Exception in case of PostMultipartAsync as the sent request is not usable.
Hello,
I found incorrect Flurl behavior when re-using a Flurlrequest object with multiple PostMultipartAsyncs.
For example, with this kind of snippet, to fetch some attachments from a famous support case manager (service now) to sync with a famous other ticketing system (jira):
For the first iteration in fiddler/wireshark, everything seems fine
But, when the stream is updated and we try to recycle the FlurlRequest object, boundary is not changed (still 6553d643-ca40-434f-a980-7253ee239492 ). That means the pointer is wrong and the server has no content to handle. In that case, no attachement in the ticketing system.
Is that a bug or something missed on our side?
I fixed it currently with a re-instanciation of the object inside the loop.