Skip to content

Commit 545b578

Browse files
authored
Merge pull request #45 from xushiwei/test
rename yap.Token => yap.Bearer
2 parents 6388c84 + 2d5c1cf commit 545b578

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

ytest/auth.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,14 @@ package ytest
1818

1919
import (
2020
"github.com/goplus/yap/ytest/auth"
21-
"github.com/goplus/yap/ytest/auth/token"
21+
"github.com/goplus/yap/ytest/auth/bearer"
2222
)
2323

2424
// -----------------------------------------------------------------------------
2525

26-
func Oauth2(auth string) auth.RTComposer {
27-
return nil
28-
}
29-
30-
// Token creates an Authorization by specified token.
31-
func Token(auth string) auth.RTComposer {
32-
return token.New(auth)
26+
// Bearer creates a Bearer Authorization by specified token.
27+
func Bearer(token string) auth.RTComposer {
28+
return bearer.New(token)
3329
}
3430

3531
// -----------------------------------------------------------------------------

ytest/auth/token/token.go ytest/auth/bearer/token.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package token
17+
package bearer
1818

1919
import (
2020
"net/http"
@@ -30,7 +30,7 @@ type tokenRounderTripper struct {
3030
}
3131

3232
func (p *tokenRounderTripper) RoundTrip(req *http.Request) (*http.Response, error) {
33-
req.Header.Set("Authorization", p.token)
33+
req.Header.Set("Authorization", "Bearer "+p.token)
3434
return p.rt.RoundTrip(req)
3535
}
3636

0 commit comments

Comments
 (0)