lazyengineering / faststatus

Simple API for sharing if a resource is free, busy, or very busy
MIT License
1 stars 2 forks source link

Decode correct Content-Type #41

Open jessecarl opened 7 years ago

jessecarl commented 7 years ago

Part of #36

Inspect the Content-Type being provided in the request body and use the correct decoder to unmarshal Resources.

Unsupported request body content type should result in a 415 response.

jessecarl commented 7 years ago

This comes down to mapping http requests to the store methods and other functions exposed by the API. We have the following endpoints:

Given these simple mappings, we only really need a decoder for the store.Save method. One remaining question is what order errors present themselves. I think, for the purpose of this service, the correct path is checked before the correct method.