Closed vrunoa closed 1 year ago
Thank you for sharing your concerns. To be honest, I do not recall the reason for setting it to true or even having this feature at all. I agree that displaying a pretty response is a client concern ; even a browser can doit (w/o plugin). Removing it is not possible (backward compatibility) but setting it to false should not be a problem to users of the package. Btw, to avoid the racing problem, you could put the call in an init() function of your package.
@emicklei yeah changing this default value would definitely be a major change. Wonder if it could be set up at the container level 🤔 ? But maybe is not worth it as init()
solves the race condition.
Hi @emicklei I'm using your package and wonder if we can have a discussion on setting the default value for
PrettyPrintResponses
tofalse
https://github.com/emicklei/go-restful/blob/v3/response.go#L18As I add your package into new services, I have to add
restful.PrettyPrintResponses = false
and wonder what's your context and use case for the default value on REST API to show the response in a pretty format? As this is something that could be easily achieved in the client sideAlso, when trying to run multiple instances in parallel when trying to set
restful.PrettyPrintResponses
Golang is raising errors when running test with-race
flag, as it could be a sync issue.Looking forward to hear your feedback, and if a PR would be accepted.