1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package util
- import (
- "net/http"
- "strings"
- )
- func OkResponse() *http.Response {
- header := make(http.Header)
- res := &http.Response{
- Status: "OK",
- StatusCode: 200,
- Proto: "HTTP/1.1",
- ProtoMajor: 1,
- ProtoMinor: 1,
- Header: header,
- }
- return res
- }
- func GetHostFromAddr(addr string) (host string) {
- strs := strings.Split(addr, ":")
- if len(strs) > 1 {
- host = strs[0]
- } else {
- host = addr
- }
- return
- }
|