Thanks to everyone who reassured me.
I considered posting a set of links from the most popular Golang tutorials
that do not return after calling http.Error(), but then baulked
In any case, thanks once again to all in this thread.
Regards
On Wed, Jul 5, 2023 at 4:13 AM ben...@gmail.com wrote:
> Every example of http Handler that I have seen so far looks like this:
Yes, that's definitely odd. I just grepped my Go source directory (which
includes the Go compiler and stdlib and a bunch of other Go code), and
almost all of them have a "return" on the next line. For example:
$ rg
On Tue, Jul 4, 2023 at 5:38 PM Gurunandan Bhat wrote:
> Every example of http Handler that I have seen so far looks like this:
>
> func handleSomeRequest(w http.ResponseWriter, r *http.Request) {
>
> // do something that returns an error
> if err != nil {
> http.Error(w,
Every example of http Handler that I have seen so far looks like this:
func handleSomeRequest(w http.ResponseWriter, r *http.Request) {
// do something that returns an error
if err != nil {
http.Error(w, "Something bad happened", http.SomeAppropriateStatus)
}
// do other