# Functions

This adds CORS headers for all requests (to use if web server is running locally).
No description provided by the author
Check if the requesterIdHeader exists and is valid and return 400 if not.
This function manually marshals the json payload, and checks to see if it marshals to valid json before writing the header and response We use this function in order to write a proper error status if the passed-in data does not marshal properly If we do this: w.WriteHeader(status) return json.NewEncoder(w).Encode(payload) Then, if the `Encode` function errors, the status will already have been set and will not be set by any error function down the line, thus masking the status output from the server (For example, we write 200 status, then the function errors, and an error bubbles-up, but a 500 error code cannot be written because the 200 was already written) Likewise if we do this: if err = json.NewEncoder(w).Encode(payload); err == nil { w.WriteHeader(status) } Then, only a 200 code is ever written and the WriteHeader call is ignored because data has already been written to the ResponseWriter Thus we can use this `CheckJSONMarshalAndWrite` function to capture the error appropriately See golang ResponseWriter for how information on the `WriteHeader` works https://pkg.go.dev/net/[email protected]#ResponseWriter NOTE: The `w.Write` call can also fail (due to network isues for example ) in which case the server will not respond with the correct status code regardless (because it cannot write ANY status code) But we still capture the error to bubble it up and do any logging/handling on the server side Info comes from: https://stackoverflow.com/questions/49483111/http-override-http-header-code-in-golang-while-there-is-an-error-in-json-encodin */.
No description provided by the author
Be sure to pass in pointer to InputObject Usage: PreProcessInput(&model, 500, w, r, fn).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
See notes on logic func in StandardRequestHandler-- must return a pointer to a struct or jsonapi library will not work right (json library doesn't care).
No description provided by the author
Note that preprocessFunc returns a 400 Bad Request on ANY error So try to make sure that any errors the function returns are actual bad user input errors and not any other kind of logical error (ex, a failed http request in the func *should* probably return 500, but will not) If you REALLY want to control the error, use an empty `preprocessFunc` and put everything in the `logicFunc` NOTE: logicFunc should return a POINTER to your struct instead of the struct or else things might not work right-- see comment in code.
No description provided by the author
No description provided by the author
No description provided by the author
Print out all route info Walk function taken from example https://github.com/gorilla/mux#walking-routes.
See notes on jsonapi library-- must pass in in a POINTER to a struct or slice of pointers, or jsonapi library will not work right (json library doesn't care).
No description provided by the author
Must use a pointer.
Convenience function so you don't have to write your own wrapper function if you don't want to return NoContent.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author