0

I use an application where i enter information regarding a product. Each product has a unique id and can be entered only once, when i try to enter the same product once again in the application it gives me "504" error stating product has already been entered. I understand that its a validation but i do not understand why its returning status code as 504. With my limited knowledge i do know that 504 status signifies that a upstream server has not responded back to the proxy/gateway which in turn would return a status 504 to the browser. Here are my questions 1. Can we explicitly send a status code to the browser through backend code? 2. If Question 1 is possible Why do you think developer of that application is sending a 504 status for duplicate entry?

Thanks in advance

DPH
  • 261
  • 4
  • 16

1 Answers1

1
  1. Yes, you can send status codes to a client. The method of doing so varies with your server language, but it's definitely possible.

  2. My best guess is that the server application is having some kind of error causing the 504 response. It may not be intentional on their part.

EDIT: After reading your post again, it sounds like you get a 504 error AND a message stating that the record exists. If that's the case, then I am just as baffled as you :) Http error codes are meant to let the client know that something is wrong with the http service; custom validation should be handled using non-Http Exceptions or easy-to-understand validation messages.

RemedialBear
  • 644
  • 5
  • 15