go-talks | my go talks
kandi X-RAY | go-talks Summary
kandi X-RAY | go-talks Summary
my go talks
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of go-talks
go-talks Key Features
go-talks Examples and Code Snippets
Community Discussions
Trending Discussions on go-talks
QUESTION
I need to replace an existing API interface with one that considers an incoming Auth token and also issues a machine-to-machine token for the outgoing service calls.
In summary, this is an API using gorilla/mux routing framework and I'm just adding endpoints to a mux.NewRouter(). Nothing fancy...yet ;).
I have been trying a few different patterns, but the one that seems most appealing is the Adapter Interface derived by Mat Ryer in https://medium.com/@matryer/writing-middleware-in-golang-and-how-go-makes-it-so-much-fun-4375c1246e81 and https://go-talks.appspot.com/github.com/matryer/golanguk/building-apis.slide#30
In summary with no direct logic, I have done the following and get stuck in an infinite loop when I run the endpoint from Postman.
...{"level":"info","msg":"New Relic Checkpoint!!! /endpoint","time":"2019-08-19T14:28:27-05:00"} {"level":"info","msg":"Security Checkpoint!!! /endpoint","time":"2019-08-19T14:28:27-05:00"} {"level":"info","msg":"Header Checkpoint!!! /endpoint","time":"2019-08-19T14:28:27-05:00"} {"level":"info","msg":"New Relic Checkpoint!!! /endpoint","time":"2019-08-19T14:28:27-05:00"} {"level":"info","msg":"Security Checkpoint!!! /endpoint","time":"2019-08-19T14:28:27-05:00"} {"level":"info","msg":"Header Checkpoint!!! /endpoint","time":"2019-08-19T14:28:27-05:00"}
ANSWER
Answered 2019-Aug-29 at 23:09I think this is because your chain of handlers ends with r, in effect becoming:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install go-talks
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page