Skip to content

Commit

Permalink
Merge pull request #30 from xushiwei/app
Browse files Browse the repository at this point in the history
yaptest example
  • Loading branch information
xushiwei authored Jan 22, 2024
2 parents 3c48536 + 3041afb commit 91d893a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ytest/classfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
package ytest

import (
"fmt"
"io"
"net/http"
"strings"
)

const (
GopPackage = true
)

// -----------------------------------------------------------------------------

type App struct {
Expand All @@ -48,6 +51,13 @@ func Gopt_App_Main(app interface{ initApp() *App }, workers ...interface{ initCa
}
}

// Host replaces a host into real. For example:
//
// host "https://example.com" "http://localhost:8080"
// host "http://example.com" "http://localhost:8888"
func (p *App) Host(host, real string) {
}

func (p *App) hostOf(url string) (host string, url2 string, ok bool) {
// http://host/xxx or https://host/xxx
var istart int
Expand Down Expand Up @@ -84,8 +94,8 @@ func (p *App) newRequest(method, url string, body io.Reader) (req *http.Request,

// -----------------------------------------------------------------------------

func Echo(v ...any) {
fmt.Println(v...)
func Oauth2(auth string) RTComposer {
return nil
}

// -----------------------------------------------------------------------------
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions ytest/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,5 @@ func (p *Request) RetWith(code any) *Request {
func (p *Request) Resp() *Response {
return p.resp
}

// -----------------------------------------------------------------------------
4 changes: 4 additions & 0 deletions ytest/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func (p *Response) MatchHeader(key string, value any) {
}
}

func (p *Response) Body() any {
return nil
}

func (p *Response) MatchBody(bodyType string, body any) {
}

Expand Down

0 comments on commit 91d893a

Please sign in to comment.