♻️ Improved metadata endpoint support
This commit is contained in:
parent
9078c72874
commit
d67279438a
|
@ -1,11 +1,11 @@
|
|||
package http
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/fasthttp/router"
|
||||
"github.com/goccy/go-json"
|
||||
http "github.com/valyala/fasthttp"
|
||||
|
||||
"source.toby3d.me/toby3d/middleware"
|
||||
"source.toby3d.me/website/indieauth/internal/common"
|
||||
"source.toby3d.me/website/indieauth/internal/domain"
|
||||
)
|
||||
|
@ -103,7 +103,11 @@ func NewRequestHandler(config *domain.Config) *RequestHandler {
|
|||
}
|
||||
|
||||
func (h *RequestHandler) Register(r *router.Router) {
|
||||
r.GET("/.well-known/oauth-authorization-server", h.read)
|
||||
chain := middleware.Chain{
|
||||
middleware.LogFmt(),
|
||||
}
|
||||
|
||||
r.GET("/.well-known/oauth-authorization-server", chain.RequestHandler(h.read))
|
||||
}
|
||||
|
||||
func (h *RequestHandler) read(ctx *http.RequestCtx) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package http_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/fasthttp/router"
|
||||
"github.com/goccy/go-json"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
http "github.com/valyala/fasthttp"
|
||||
|
@ -33,7 +33,7 @@ func TestMetadata(t *testing.T) {
|
|||
assert.Equal(t, &delivery.MetadataResponse{
|
||||
AuthorizationEndpoint: cfg.Server.GetRootURL() + "authorize",
|
||||
Issuer: cfg.Server.GetRootURL(),
|
||||
ServiceDocumentation: "https://indieauth.spec.indieweb.org/",
|
||||
ServiceDocumentation: "https://indieauth.net/source/",
|
||||
TokenEndpoint: cfg.Server.GetRootURL() + "token",
|
||||
AuthorizationResponseIssParameterSupported: true,
|
||||
GrantTypesSupported: []string{
|
||||
|
|
Loading…
Reference in New Issue