Search code examples
socketshttppostwebserverwebclient

Payload in 200 OK response to POST request


I'm writing a simple socket program that implements an HTTP server that can handle POST requests. I want my server to send a 200 OK response after receiving a POST request. My problem is, I don't know what the payload of the 200 OK response should be like. According to https://www.rfc-editor.org/rfc/rfc7231#section-6.3.1, the body of 200 OK response to a POST request should be:

a representation of the status of, or results obtained from, the action

Could anyone explain what this sentence means? What is a representation of the status of the action? What should I include in the body of the response?


Solution

  • POST generally means to create something, so you could send a response containing data from the newly created resource. Alternatively you could respond with 201 and no body.