-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: int32 is converted to incorrect string (#416)
* bugfix: int32 is incorrectly converted to string * ignore stringify for string type * generate go code * add test case
- Loading branch information
Showing
8 changed files
with
83 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
linebot/messaging_api/tests/handwritten/api_GetFollowers_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package tests | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"log" | ||
"net/http" | ||
"net/http/httptest" | ||
"testing" | ||
|
||
"github.com/line/line-bot-sdk-go/v8/linebot/messaging_api" | ||
) | ||
|
||
func TestGetFollowers_ItShouldCorrectlyPassLimitQueryParameter(t *testing.T) { | ||
expectedLimit := "1000" | ||
server := httptest.NewServer( | ||
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
gotLimit := r.URL.Query().Get("limit") | ||
if gotLimit != expectedLimit { | ||
w.Header().Set("TEST-ERROR", fmt.Sprintf("incorrect limit being sent from client. expected %s, got %s", expectedLimit, gotLimit)) | ||
w.WriteHeader(http.StatusInternalServerError) | ||
return | ||
} | ||
json.NewEncoder(w).Encode(messaging_api.GetFollowersResponse{UserIds: []string{}, Next: "abcdef"}) | ||
}), | ||
) | ||
client, err := messaging_api.NewMessagingApiAPI( | ||
"channelToken", | ||
messaging_api.WithEndpoint(server.URL), | ||
) | ||
if err != nil { | ||
t.Fatalf("Failed to create client: %v", err) | ||
} | ||
resp, _, err := client.GetFollowersWithHttpInfo("", 1000) | ||
if err != nil { | ||
t.Fatalf("Failed to get followers: %v", err) | ||
} | ||
log.Printf("Got response: %v", resp) | ||
if resp.StatusCode != http.StatusOK { | ||
t.Errorf("Not getting 200 response back: %s", resp.Header.Get("TEST-ERROR")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters