Skip to content

Commit 3cdeba2

Browse files
committed
Fix error: lookup uses GET
1 parent ed3abe4 commit 3cdeba2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lookup/lookup.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ const hlrPath = "hlr"
4444
// lookupPath represents the path to the Lookup resource.
4545
const lookupPath = "lookup"
4646

47-
// Create performs a new lookup for the specified number.
48-
func Create(c *messagebird.Client, phoneNumber string, params *Params) (*Lookup, error) {
47+
// Read performs a new lookup for the specified number.
48+
func Read(c *messagebird.Client, phoneNumber string, params *Params) (*Lookup, error) {
4949
urlParams := paramsForLookup(params)
5050
path := lookupPath + "/" + phoneNumber + "?" + urlParams.Encode()
5151

5252
lookup := &Lookup{}
53-
if err := c.Request(lookup, http.MethodPost, path, nil); err != nil {
53+
if err := c.Request(lookup, http.MethodGet, path, nil); err != nil {
5454
return nil, err
5555
}
5656

lookup/lookup_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ func TestMain(m *testing.M) {
1313
mbtest.EnableServer(m)
1414
}
1515

16-
func TestCreate(t *testing.T) {
16+
func TestRead(t *testing.T) {
1717
mbtest.WillReturnTestdata(t, "lookupObject.json", http.StatusOK)
1818
client := mbtest.Client(t)
1919

2020
phoneNumber := "31624971134"
21-
lookup, err := Create(client, phoneNumber, &Params{CountryCode: "NL"})
21+
lookup, err := Read(client, phoneNumber, &Params{CountryCode: "NL"})
2222
if err != nil {
2323
t.Fatalf("Didn't expect error while doing the lookup: %s", err)
2424
}

0 commit comments

Comments
 (0)