Skip to content

Commit

Permalink
Merge pull request #22 from traPtitech/fix/header
Browse files Browse the repository at this point in the history
🐛  fix post header
  • Loading branch information
hijiki51 authored Jan 4, 2022
2 parents 5abfd94 + 943da7f commit 97f818e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/dghubble/sling"
"go.uber.org/zap"
"io"
"net/http"
"os"
"path/filepath"
"strings"

"github.com/dghubble/sling"
"go.uber.org/zap"
)

type Servers map[string]*Server
Expand Down Expand Up @@ -160,7 +161,7 @@ func (sc *ServerRestartCommand) Execute(ctx *Context) error {
Base(config.ConohaComputeApiOrigin).
Post(fmt.Sprintf("v2/%s/servers/%s/action", config.ConohaTenantID, sc.server.ServerID)).
BodyJSON(Map{"reboot": Map{"type": args[0]}}).
Set("Content-Type", "application/json").
Set("Accept", "application/json").
Set("X-Auth-Token", token).
Request()
if err != nil {
Expand Down Expand Up @@ -256,7 +257,7 @@ func getConohaAPIToken() (string, error) {
Base(config.ConohaIdentityApiOrigin).
Post("v2.0/tokens").
BodyJSON(requestJson).
Set("Content-Type", "application/json").
Set("Accept", "application/json").
Request()
if err != nil {
return "", fmt.Errorf("failed to create authentication request: %w", err)
Expand Down

0 comments on commit 97f818e

Please sign in to comment.