forked from loafle/openapi-generator-original
* Issue 1766 Modified mustache files for Go to support nullable in the spec v3.0+; Updated model files running .sh scripts for Go. * Add "nullable" to fake yaml * Add sample script for OAS3 * Fix output folder (openapi3) * Run bin/openapi3/go-petstore.sh * Update samples * Update jaxrs-jersey * Update python and php samples * Add bin/openapi3/go-gin-petstore-server.sh * Run bin/openapi3/go-gin-petstore-server.sh * Update bin/openapi3/go-petstore-server.sh to generate "nullable" samples * Run bin/openapi3/go-petstore-server.sh * Fix duplicated `import`
33 lines
630 B
Go
33 lines
630 B
Go
/*
|
|
* OpenAPI Petstore
|
|
*
|
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
|
*
|
|
* API version: 1.0.0
|
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
*/
|
|
|
|
package petstoreserver
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
func Logger(inner http.Handler, name string) http.Handler {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
start := time.Now()
|
|
|
|
inner.ServeHTTP(w, r)
|
|
|
|
log.Printf(
|
|
"%s %s %s %s",
|
|
r.Method,
|
|
r.RequestURI,
|
|
name,
|
|
time.Since(start),
|
|
)
|
|
})
|
|
}
|