readium-lcp-server
readium-lcp-server copied to clipboard
Draft of wrapping more LCP license functionality into the library instead of handlers.
Goal: Wrap more of the functionality of LCP server into exported functions that can be used as a library from other Go services.
For example it seems useful to wrap validation things like checkGetLicenseInput, copyInputToLicense, buildLicense, etc inside a single, exported function that can be called from outside an HTTP handler.
Context:
- We'd like to use the LCP/LSD servers as libraries in our existing Go project so we don't have the additional Ops overhead of running additional servers
- I am assuming will we want input validation on partial licenses and other inputs to the LCP license handlers - this was the motivation for moving more things into the exported license.go functions
Some other changes in this PR:
- A couple of the HTTP response codes in the license handlers has changed. To try to not change them too much, I introduced a new
Errorthat wraps more detailed input-validation error messages