https://kotlinlang.org logo
#random
Title
# random
u

ursus

11/29/2019, 3:37 PM
Is there expectation if client cancels http post request, that server will cancel its action and revert transactions?
t

tddmonkey

11/29/2019, 3:59 PM
In relation to a specific tech or in general?
u

ursus

11/29/2019, 6:44 PM
in general, if client cancels POST postMessage, wether should server cancel & rollback transaction of that if not finished yet
c

cedric

11/29/2019, 7:03 PM
How do you cancel a POST?
u

ursus

11/30/2019, 3:12 AM
well, I mean canceling okhttp Request, whatever that means, probably closing the socket
h

hallvard

11/30/2019, 7:04 AM
I think the questions here reveal the answer. In general, noone will expect you to try a rollback. If the POST request is already fired off and the client changes his mind before receiving an answer, let that be the client's problem and do not roll back anything on the server.
u

ursus

11/30/2019, 7:15 AM
But why? Because its better, or because its hard to do on backend so they dont bother?
h

hallvard

11/30/2019, 7:20 AM
The way I see it, since the client cannot know what procedures go on on the server side and cannot even know if the cancelling of the request took place before the server had time to do anything or after a reply had already been sent, I would expect the client to expect the server to have done lots of stuff and not roll back. It's just a pragmatic approach.
c

cedric

11/30/2019, 5:10 PM
My point was that since POST cannot be canceled at the HTTP level, it needs to be a separate API call. And obviously, in that separate API call, the server will perform the revert operation.
u

ursus

11/30/2019, 7:48 PM
It doesnt? Okay im not an expert. Okay thanks guys
3 Views