Skip to content

Commit

Permalink
Updated domain/search
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <vr@labstack.com>
  • Loading branch information
vishr committed Dec 10, 2019
1 parent 3c3ffe0 commit c8f9648
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import "os"

var (
client = NewClient(os.Getenv("KEY"))
cs = client.Currency()
ds = client.Domain()
es = client.Email()
is = client.IP()
ws = client.Webpage()
cs = client.Currency()
ds = client.Domain()
es = client.Email()
is = client.IP()
ws = client.Webpage()
)
6 changes: 2 additions & 4 deletions domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ func (d *DomainService) Search(req *domain.SearchRequest) (*domain.SearchRespons
res := new(domain.SearchResponse)
err := new(Error)
r, e := d.resty.R().
SetPathParams(map[string]string{
"domain": req.Domain,
}).
SetQueryParam("q", req.Q).
SetResult(res).
SetError(err).
Get("/search/{domain}")
Get("/search")
if e != nil {
return nil, &Error{
Message: err.Error(),
Expand Down
2 changes: 1 addition & 1 deletion domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type (
}

SearchRequest struct {
Domain string
Q string
}

SearchResponse struct {
Expand Down
5 changes: 3 additions & 2 deletions domain_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package labstack

import (
"testing"

"github.com/labstack/labstack-go/domain"
"github.com/stretchr/testify/assert"
"testing"
)

func TestClient_DNS(t *testing.T) {
Expand All @@ -18,7 +19,7 @@ func TestClient_DNS(t *testing.T) {

func TestClient_Search(t *testing.T) {
res, err := ds.Search(&domain.SearchRequest{
Domain: "twilio.com",
Q: "twilio",
})
if assert.Nil(t, err) {
assert.NotZero(t, len(res.Results))
Expand Down

0 comments on commit c8f9648

Please sign in to comment.