Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Add adapter for the http.Handler interface #17

Merged
merged 4 commits into from
Dec 19, 2018
Merged

Conversation

pirfalt
Copy link

@pirfalt pirfalt commented Aug 22, 2018

Issue #18

Description of changes:

Add a new HandlerAdapter for the http.HandlerFunc interface.

This is a general interface which all the other concrete adapter sources already implements. In addition to, example https://github.com/grpc-ecosystem/grpc-gateway and the go standard library.

Any of them could delegate to this adapter if they wanted to.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Emil Pirfält added 2 commits August 22, 2018 16:09
The adapter already uses handlerFunc via it's interface, calls `handlerFunc.ServeHTTP(args)` instead of `handlerFunc(args)`.

Change to accept any interface implementation instead of only the `http.HandlerFunc` implementation.
@pirfalt pirfalt mentioned this pull request Aug 22, 2018
@pirfalt pirfalt changed the title Accept any http.Handler implementation in HandlerFuncAdapter Add adapter for the http.Handler interface Aug 22, 2018
@leesio
Copy link

leesio commented Oct 9, 2018

This seems like a no brainer to me. I don't really understand why there's a HandlerFunc adapter and not a Handler adapter. AHandler adapter is more closely aligned with the other adapters as it allows the use of the http.ServeMux as a multiplexer.

@sapessi sapessi merged commit e7766d8 into awslabs:master Dec 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants