Skip to content

Commit

Permalink
Merge pull request #17 from moul/fix-16
Browse files Browse the repository at this point in the history
Fix arguments passing (fix #16)
  • Loading branch information
moul committed Oct 12, 2015
2 parents 414dbae + db6826f commit ba7cead
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ $ brew install https://raw.githubusercontent.com/moul/ssh2docker/master/contrib/

### master (unreleased)

* No entry
* Fix arguments passing ([#16](https://github.com/moul/gotty-client/issues/16))

[full commits list](https://github.com/moul/gotty-client/compare/v1.1.0...master)

### v1.1.0 (2015-10-10)
### [v1.1.0](https://github.com/moul/gotty-client/releases/tag/v1.1.0) (2015-10-10)

* Handling arguments + using mutexes (thanks to [@QuentinPerez](https://github.com/QuentinPerez))
* Add logo ([#9](https://github.com/moul/gotty-client/issues/9))
Expand Down
15 changes: 9 additions & 6 deletions gotty-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -83,6 +82,11 @@ type Client struct {
WriteMutex *sync.Mutex
}

type querySingleType struct {
AuthToken string `json:"AuthToken"`
Arguments string `json:"Arguments"`
}

func (c *Client) write(data []byte) error {
c.WriteMutex.Lock()
defer c.WriteMutex.Unlock()
Expand Down Expand Up @@ -142,16 +146,15 @@ func (c *Client) Connect() error {
if err != nil {
return err
}
querySingle := make(map[string]string)

for key, value := range query {
querySingle[key] = value[0]
var querySingle querySingleType = querySingleType{
Arguments: "?" + query.Encode(),
AuthToken: authToken,
}

querySingle["AuthToken"] = authToken
json, err := json.Marshal(querySingle)
if err != nil {
log.Printf("Failed to parse init message %v", err)
logrus.Errorf("Failed to parse init message %v", err)
return err
}
// Send Json
Expand Down

0 comments on commit ba7cead

Please sign in to comment.