I recently did a test on an unrelated website where I use PHP and CURL inside it to access a webpage with method POST.
Without any modifications, I noticed the server returning back a 100 continue status and a 200 OK status after. I suspect square might do the same with requests to the API.
So I played with CURL, and added a header “expect:” (with value being nothing) and the website responded much faster bypassing the 100 continue status.
When I read curl documentation online, they say the 100 continue status is supposed to help stop a client from performing a large upload even if the server returns a 4xx status code.
I’m curious for those experienced with square, should I attempt to dodge the 100 status codes and gain speed, or would you think there’s a high chance of data being lost in the process?
The amount of data I’m sending per POST is minimal (like maybe 8KB at most to store customer information and execute payment) and speed would make people happy.
I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
The 100 Continue status code is a part of the HTTP/1.1 specification and is sent in response to an HTTP/1.1 request which includes the “Expect: 100-continue” header. It’s used to tell the client that the initial part of the request has been received and has not yet been rejected by the server, so the client should continue with the request, or ignore if the request has already been completed.
In the context of Square’s API, if you’re only sending small amounts of data (like 8KB as you mentioned), the overhead of the 100 Continue may not provide much benefit and could potentially slow down the request-response cycle. Therefore, it might be beneficial to bypass the 100 Continue status to gain speed, especially if the data you’re sending is not large.
However, it’s important to note that the decision to bypass the 100 Continue status should be made carefully, considering the nature of the data being sent, the network conditions, and the specific requirements of your application. If you’re unsure, it’s always a good idea to test both scenarios and see which one works best for your specific use case.