From 609f6597f1a11cdf35b3ad2da588336226863047 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Sat, 1 Jun 2024 15:18:25 +0100 Subject: Spelling fixes and adds a newline Adds a mere newline... Fixes spelling mistakes --- cmd/dbasik-api/handlers.go | 2 +- cmd/dbasik-api/helpers.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/dbasik-api/handlers.go b/cmd/dbasik-api/handlers.go index 65bf2c4..a36adf6 100644 --- a/cmd/dbasik-api/handlers.go +++ b/cmd/dbasik-api/handlers.go @@ -100,7 +100,7 @@ func (app *application) createReturnHandler(w http.ResponseWriter, r *http.Reque app.serverErrorResponse(w, r, err) } - fmt.Fprintf(w, "file successfully uploaded") + fmt.Fprintf(w, "file successfully uploaded\n") } diff --git a/cmd/dbasik-api/helpers.go b/cmd/dbasik-api/helpers.go index 68d9f66..25671d6 100644 --- a/cmd/dbasik-api/helpers.go +++ b/cmd/dbasik-api/helpers.go @@ -36,7 +36,7 @@ func validateSpreadsheetCell(cellRef string) bool { type envelope map[string]interface{} // writeJSON)Pretty() helper for sending responses - pretty prints output. This takes the destination http.ResponseWriter, the -// HTTP status code to sned, the data to encode to JSON and a header map containing any additional +// HTTP status code to send, the data to encode to JSON and a header map containing any additional // HTTP headers we want to include in the response. func (app *application) writeJSONPretty(w http.ResponseWriter, status int, data envelope, headers http.Header) error { // Encode the data to JSON, returing the error if there was one. @@ -45,14 +45,14 @@ func (app *application) writeJSONPretty(w http.ResponseWriter, status int, data return err } - // Append a newline to make it easier tro view in terminal applications + // Append a newline to make it easier to view in terminal applications js = append(js, '\n') // We know now that we won't encounter any more errors before writing the response, // so it's safe to add any headers that we want to include. We loop through the // header map and add each header to the http.ResponseWriter header map. // Note that it's okay if the provided header map is nil. Go doesn't throw an error - // if you wanmt to try to range over (or more generally reader from) a nil map. + // if you want to try to range over (or more generally reader from) a nil map. for key, value := range headers { w.Header()[key] = value } @@ -66,7 +66,7 @@ func (app *application) writeJSONPretty(w http.ResponseWriter, status int, data } // writeJSON() helper for sending responses. This takes the destination http.ResponseWriter, the -// HTTP status code to sned, the data to encode to JSON and a header map containing any additional +// HTTP status code to send, the data to encode to JSON and a header map containing any additional // HTTP headers we want to include in the response. func (app *application) writeJSON(w http.ResponseWriter, status int, data any, headers http.Header) error { // Encode the data to JSON, returing the error if there was one. @@ -75,14 +75,14 @@ func (app *application) writeJSON(w http.ResponseWriter, status int, data any, h return err } - // Append a newline to make it easier tro view in terminal applications + // Append a newline to make it easier to view in terminal applications js = append(js, '\n') // We know now that we won't encounter any more errors before writing the response, // so it's safe to add any headers that we want to include. We loop through the // header map and add each header to the http.ResponseWriter header map. // Note that it's okay if the provided header map is nil. Go doesn't throw an error - // if you wanmt to try to range over (or more generally reader from) a nil map. + // if you want to try to range over (or more generally reader from) a nil map. for key, value := range headers { w.Header()[key] = value } -- cgit v1.2.3