Empty response with or without Write method


Just want to get something clarified here. When returning a response, we can simply use, for instance, WriteHeader(200). This is enough on its own. However, we can also call Write() afterwards. This would work as well. The question is, would skipping Write() cause any problems behind the scene for responses that don’t need any body at all?


No, it’s fine. You also don’t need to explicitly WriteHeader if you just want a 200 OK response.

Thanks for the clarification @calmh .


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.