summaryrefslogblamecommitdiff
path: root/main.go
blob: 565f23c1616678e07abe2cee603071696d7b8047 (plain) (tree)
1
2
3
4
5
6
7
8
9







                  
                                                      














                                                                      
package main

import (
	"net/http"
	"net/url"
)

const (
	errSrcInvalid = "source is not a parsable URL"
)

// endpoint is a webmention receiver.
type endpoint struct {
	allowPrefix string
}

// ServeHTTP is http.Handler implementation.
func (ep endpoint) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	_, err := url.Parse(r.PostFormValue("source"))
	if err != nil {
		w.WriteHeader(http.StatusBadRequest)
		w.Write([]byte(errSrcInvalid))
	}
}