Reorg client code
This commit is contained in:
parent
61aa1be730
commit
f313a8f1c9
4 changed files with 58 additions and 37 deletions
|
@ -6,11 +6,12 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"crispbyte.dev/sig-auth/server"
|
||||
)
|
||||
|
||||
func RegisterKey(key string, userId string) error {
|
||||
func RegisterKey(baseUrl *url.URL, key string, userId string) error {
|
||||
request := server.RegisterRequest{
|
||||
UserId: userId,
|
||||
Key: key,
|
||||
|
@ -18,8 +19,10 @@ func RegisterKey(key string, userId string) error {
|
|||
|
||||
json_data, _ := json.Marshal(request)
|
||||
|
||||
registerUrl := baseUrl.JoinPath("register")
|
||||
|
||||
resp, err := http.DefaultClient.Post(
|
||||
"http://localhost:8080/register",
|
||||
registerUrl.String(),
|
||||
"application/json",
|
||||
bytes.NewBuffer(json_data))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue