Home

ugit @13a3d903d870fc099bf186483078e8b9532bb664 - refs - log -
-
https://git.jolheiser.com/ugit.git
The code powering this h*ckin' site
ugit / internal / http / session.go
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package http

import (
	"context"
	"net/http"
)

// Session fulfills git.ReadWriteContexter for an HTTP request
type Session struct {
	w http.ResponseWriter
	r *http.Request
}

// Read implements io.Reader
func (s Session) Read(p []byte) (n int, err error) {
	return s.r.Body.Read(p)
}

// Write implements io.Writer
func (s Session) Write(p []byte) (n int, err error) {
	return s.w.Write(p)
}

// Close implements io.Closer
func (s Session) Close() error {
	return s.r.Body.Close()
}

// Context implements git.ReadWriteContexter
func (s Session) Context() context.Context {
	return s.r.Context()
}