// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. //go:build script // +build script package js_test import ( "github.com/iwind/TeaGo/logs" "net/http" ) type FakeResponse struct { host string remoteAddr string header http.Header } func (this *FakeResponse) Header() http.Header { return this.header } func (this *FakeResponse) SetHeader(name string, values []string) { if this.header == nil { this.header = http.Header{} } this.header[name] = values } func (this *FakeResponse) DeleteHeader(name string) { if this.header == nil { return } delete(this.header, name) } func (this *FakeResponse) Send(status int, body string) { logs.Println("send", status, body) } func (this *FakeResponse) SendFile(status int, path string) (int64, error) { return 0, nil } func (this *FakeResponse) SendResp(resp *http.Response) (int64, error) { return 0, nil } func (this *FakeResponse) Redirect(status int, url string) { }