cowboy
cowboy copied to clipboard
REST generate_etag documentation
The documentation for generate_etag
says:
Result :: binary() | {weak | strong, binary()}
Default - no etag value
I think it should be:
Result :: undefined | binary() | {weak | strong, binary()}
Default :: undefined
Returning undefined
seems to work, and I have a use case where I need to do this.
You conditionally generate an etag?
My use case is that I have a REST callback module that handles different resources, and for some of them I can't generate an etag.
In general I like the API where I can implement the default behavior explicitly, and not just by not implementing the function. It is more flexible.
Asking only to make sure there's a use case for this.
I have no problem with adding undefined
along with a test. The expires
callback also allows undefined
explicitly.
Great, thanks!
OK for the etag we want to call generate_etag only once, but if it's currently undefined
we call the function. So the only way to make it work as intended is make sure that when the function returns undefined
we mark the etag as no_call
. I will add a test first.
Done. Closing, thanks!