Commit f819a3c5 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Rename Handler to Injecter

parent 2788c575
......@@ -24,7 +24,7 @@ type archive struct{ senddata.Prefix }
var SendArchive = &archive{"git-archive:"}
func (a *archive) Handle(w http.ResponseWriter, r *http.Request, sendData string) {
func (a *archive) Inject(w http.ResponseWriter, r *http.Request, sendData string) {
var params struct {
RepoPath string
ArchivePath string
......
......@@ -13,7 +13,7 @@ type blob struct{ senddata.Prefix }
var SendBlob = &blob{"git-blob:"}
func (b *blob) Handle(w http.ResponseWriter, r *http.Request, sendData string) {
func (b *blob) Inject(w http.ResponseWriter, r *http.Request, sendData string) {
var params struct{ RepoPath, BlobId string }
if err := b.Unpack(&params, sendData); err != nil {
helper.Fail500(w, fmt.Errorf("SendBlob: unpack sendData: %v", err))
......
......@@ -70,13 +70,13 @@ func (s *sendFileResponseWriter) WriteHeader(status int) {
if header := s.Header().Get(senddata.Header); header != "" {
s.Header().Del(senddata.Header)
for _, handler := range []senddata.Handler{
for _, handler := range []senddata.Injecter{
git.SendBlob,
git.SendArchive,
} {
if handler.Match(header) {
s.hijacked = true
handler.Handle(s.rw, s.req, header)
handler.Inject(s.rw, s.req, header)
return
}
}
......
......@@ -7,9 +7,9 @@ import (
"strings"
)
type Handler interface {
type Injecter interface {
Match(string) bool
Handle(http.ResponseWriter, *http.Request, string)
Inject(http.ResponseWriter, *http.Request, string)
}
type Prefix string
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment