Skip to content

Commit

Permalink
Merge pull request #38 from apivideo/fix-tags-query-param
Browse files Browse the repository at this point in the history
fix(php) Fix tags query param
  • Loading branch information
bot-api-video authored Jan 10, 2022
2 parents 24f30d6 + cf22cbc commit b1676fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ paths:
example: '["captions", "dialogue"]'
explode: true
in: query
name: tags
name: tags[]
required: false
schema:
items:
Expand Down
4 changes: 2 additions & 2 deletions api_videos.go

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

10 changes: 7 additions & 3 deletions api_videos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/url"
"os"
"reflect"
"strings"
"testing"
)

Expand Down Expand Up @@ -73,7 +74,7 @@ var videoJSONResponses = []string{`{
"iframe": "<iframe src='//embed.api.video/vod/vi6HangYsow3vXxwdx3YMlAb' width='100%' height='100%' frameborder='0' scrolling='no' allowfullscreen=''></iframe>",
"player": "https://embed.api.video/vod/vi6HangYsow3vXxwdx3YMlAb",
"hls": "https://cdn.api.video/vod/vi6HangYsow3vXxwdx3YMlAb/hls/manifest.m3u8",
"thumbnail": "https://cdn.api.video/vod/vi6HangYsow3vXxwdx3YMlAb/thumbnail.jpg"
"thumbnail": "https://cdn.api.video/vod/vi6HangYsow3vXxwdx3YMlAb/thumbnail.jpg"
}
}`,
}
Expand Down Expand Up @@ -327,10 +328,13 @@ func TestVideos_List(t *testing.T) {
"pageSize": []string{"25"},
"sortBy": []string{"publishedAt"},
"sortOrder": []string{"desc"},
"tags": []string{"tag1", "tag2"},
"tags[]": []string{"tag1", "tag2"},
"metadata[key]": []string{"value"},
"metadata[key2]": []string{"value2"},
}
if !strings.Contains(r.URL.String(), "tags%5B%5D=tag1&tags%5B%5D=tag2") {
t.Errorf("Tags are not properly set in the query string")
}
if !reflect.DeepEqual(r.URL.Query(), expectedQuery) {
t.Errorf("Request querystring\n got=%#v\nwant=%#v", r.URL.Query(), expectedQuery)
}
Expand Down Expand Up @@ -374,7 +378,7 @@ func TestVideos_ListUpdatedAt(t *testing.T) {
"pageSize": []string{"25"},
"sortBy": []string{"updatedAt"},
"sortOrder": []string{"desc"},
"tags": []string{"tag1", "tag2"},
"tags[]": []string{"tag1", "tag2"},
"metadata[key]": []string{"value"},
"metadata[key2]": []string{"value2"},
}
Expand Down

0 comments on commit b1676fb

Please sign in to comment.