feat: support clients that send the API params as a x-www-form-urlencoded POST

This commit is contained in:
Deluan
2020-01-27 15:10:46 -05:00
parent cffae3a7d6
commit 1278863416
5 changed files with 77 additions and 18 deletions
+4 -4
View File
@@ -42,7 +42,7 @@ var _ = Describe("MediaRetrievalController", func() {
Describe("GetCoverArt", func() {
It("should return data for that id", func() {
cover.data = "image data"
r := newTestRequest("id=34", "size=128")
r := newGetRequest("id=34", "size=128")
_, err := controller.GetCoverArt(w, r)
Expect(err).To(BeNil())
@@ -52,7 +52,7 @@ var _ = Describe("MediaRetrievalController", func() {
})
It("should fail if missing id parameter", func() {
r := newTestRequest()
r := newGetRequest()
_, err := controller.GetCoverArt(w, r)
Expect(err).To(MatchError("id parameter required"))
@@ -60,7 +60,7 @@ var _ = Describe("MediaRetrievalController", func() {
It("should fail when the file is not found", func() {
cover.err = model.ErrNotFound
r := newTestRequest("id=34", "size=128")
r := newGetRequest("id=34", "size=128")
_, err := controller.GetCoverArt(w, r)
Expect(err).To(MatchError("Cover not found"))
@@ -68,7 +68,7 @@ var _ = Describe("MediaRetrievalController", func() {
It("should fail when there is an unknown error", func() {
cover.err = errors.New("weird error")
r := newTestRequest("id=34", "size=128")
r := newGetRequest("id=34", "size=128")
_, err := controller.GetCoverArt(w, r)
Expect(err).To(MatchError("Internal Error"))