-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds support for the `POST` HTTP method. The adapter will now accept the `POST` method and call the `Add` method defined in the `AddHandler` interface. An implementation of this interface will receive the request body already parsed, and should add the object to the collection and return it. For example, a simple implementation that stores the object in a map in memory could look like this: ```go func (h *MyHandler) Add(ctx context.Context, request *AddRequest) (respone *AddResponse, err error) { h.storeLock.Lock() defer h.storeLock.Unlock() h.storeMap[request.Variables[0]] = request.Object response := &AddResponse{ Object: request.Object, } return } ``` In order to make naming of the interfaces more consistent this patch also renames `ObjectHandler` to `GetHandler` and `CollectionHandler` to `ListHandler`. That way all interfaces are named after the operation they represent. Signed-off-by: Juan Hernandez <[email protected]>
- Loading branch information
Showing
4 changed files
with
301 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.