Skip to content

Commit

Permalink
Merge #163
Browse files Browse the repository at this point in the history
163: Rename ApiKey by APIKey r=alallema a=alallema

Like it was!

Not breaking because a rollback in the same release

Co-authored-by: alallema <amelie@meilisearch.com>
  • Loading branch information
bors[bot] and alallema authored Jun 29, 2021
2 parents 1f4f621 + df30972 commit f14742c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import (
func main() {
client := meilisearch.NewClient(meilisearch.ClientConfig{
Host: "http://127.0.0.1:7700",
ApiKey: "masterKey",
APIKey: "masterKey",
})
// An index is where the documents are stored.
index := client.Index("indexUID")
Expand Down
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type ClientConfig struct {
// Example: 'http://localhost:7700'
Host string

// ApiKey is optional
ApiKey string
// APIKey is optional
APIKey string

// Timeout is optional
Timeout time.Duration
Expand Down
4 changes: 2 additions & 2 deletions client_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func (c *Client) sendRequest(req *internalRequest, internalError *Error, respons

// adding request headers
request.Header.Set("Content-Type", "application/json")
if c.config.ApiKey != "" {
request.Header.Set("X-Meili-API-Key", c.config.ApiKey)
if c.config.APIKey != "" {
request.Header.Set("X-Meili-API-Key", c.config.APIKey)
}

// request is sent
Expand Down
4 changes: 2 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func TestClient_Health(t *testing.T) {
client: &Client{
config: ClientConfig{
Host: "http://wrongurl:1234",
ApiKey: masterKey,
APIKey: masterKey,
},
httpClient: &fasthttp.Client{
Name: "meilsearch-client",
Expand Down Expand Up @@ -213,7 +213,7 @@ func TestClient_IsHealthy(t *testing.T) {
client: &Client{
config: ClientConfig{
Host: "http://wrongurl:1234",
ApiKey: masterKey,
APIKey: masterKey,
},
httpClient: &fasthttp.Client{
Name: "meilsearch-client",
Expand Down
10 changes: 5 additions & 5 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func deleteAllIndexes(client ClientInterface) (ok bool, err error) {
func SetUpBasicIndex() {
client := NewClient(ClientConfig{
Host: "http://localhost:7700",
ApiKey: masterKey,
APIKey: masterKey,
})
index := client.Index("indexUID")

Expand All @@ -62,7 +62,7 @@ func SetUpBasicIndex() {
func SetUpIndexForFaceting() {
client := NewClient(ClientConfig{
Host: "http://localhost:7700",
ApiKey: masterKey,
APIKey: masterKey,
})
index := client.Index("indexUID")

Expand Down Expand Up @@ -103,12 +103,12 @@ var masterKey = "masterKey"
var primaryKey = "primaryKey"
var defaultClient = NewClient(ClientConfig{
Host: "http://localhost:7700",
ApiKey: masterKey,
APIKey: masterKey,
})

var customClient = NewFastHTTPCustomClient(ClientConfig{
Host: "http://localhost:7700",
ApiKey: masterKey,
APIKey: masterKey,
},
&fasthttp.Client{
TLSConfig: &tls.Config{InsecureSkipVerify: true},
Expand All @@ -117,7 +117,7 @@ var customClient = NewFastHTTPCustomClient(ClientConfig{

var timeoutClient = NewClient(ClientConfig{
Host: "http://localhost:7700",
ApiKey: masterKey,
APIKey: masterKey,
Timeout: 1,
})

Expand Down

0 comments on commit f14742c

Please sign in to comment.