Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Play Android recommendation requests
Browse files Browse the repository at this point in the history
pyby committed Nov 7, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent fa19905 commit 646c681
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ public class RecommendationController {
RecommendationService service;

@Deprecated
@RequestMapping("/api/v1/playlist/recommendation/{purpose}/{urn}")
@RequestMapping({"/api/v1/playlist/recommendation/{purpose}/{urn}", "/api/v1/playlist/recommendation/{purpose}/{urn}.json"})
@ResponseBody
Object recommendationV1(
HttpServletRequest request,
@@ -43,7 +43,7 @@ Object recommendationV1(
}
}

@RequestMapping("/api/v2/playlist/recommendation/{purpose}/{urn}")
@RequestMapping({"/api/v2/playlist/recommendation/{purpose}/{urn}", "/api/v2/playlist/recommendation/{purpose}/{urn}.json"})
@ResponseBody
RecommendedList recommendationV2(
HttpServletRequest request,
Original file line number Diff line number Diff line change
@@ -159,6 +159,10 @@ private void getRecommendationURNFormat(String mediaURN, boolean isAvailable) th
mvc.perform(get("/api/v1/playlist/recommendation/" + purpose + "/" + mediaURN).param("standalone", "false").param("format", format)).andExpect(status().isOk()).andExpect(jsonPath("$").isArray());
mvc.perform(get("/api/v1/playlist/recommendation/" + purpose + "/" + mediaURN).param("standalone", "true").param("format", format)).andExpect(status().isOk()).andExpect(jsonPath("$").isArray());

mvc.perform(get("/api/v1/playlist/recommendation/" + purpose + "/" + mediaURN + ".json").param("format", format)).andExpect(status().isOk()).andExpect(jsonPath("$").isArray());
mvc.perform(get("/api/v1/playlist/recommendation/" + purpose + "/" + mediaURN + ".json").param("standalone", "false").param("format", format)).andExpect(status().isOk()).andExpect(jsonPath("$").isArray());
mvc.perform(get("/api/v1/playlist/recommendation/" + purpose + "/" + mediaURN + ".json").param("standalone", "true").param("format", format)).andExpect(status().isOk()).andExpect(jsonPath("$").isArray());

mvc.perform(get("/api/v1/playlist/recommendation/" + purpose + "/" + mediaURN).param("format", format)).andExpect(status().isOk()).andExpect(isAvailable ? jsonPath("$[0]").value(mediaURN) : jsonPath("$").isEmpty());
mvc.perform(get("/api/v1/playlist/recommendation/" + purpose + "/" + mediaURN).param("standalone", "false").param("format", format)).andExpect(isAvailable ? jsonPath("$[0]").value(mediaURN) : jsonPath("$").isEmpty());
mvc.perform(get("/api/v1/playlist/recommendation/" + purpose + "/" + mediaURN).param("standalone", "true").param("format", format)).andExpect(isAvailable ? jsonPath("$[0]").value(mediaURN) : jsonPath("$").isEmpty());
@@ -167,6 +171,10 @@ private void getRecommendationURNFormat(String mediaURN, boolean isAvailable) th
mvc.perform(get("/api/v2/playlist/recommendation/" + purpose + "/" + mediaURN).param("standalone", "false")).andExpect(status().isOk()).andExpect(jsonPath("$").isMap());
mvc.perform(get("/api/v2/playlist/recommendation/" + purpose + "/" + mediaURN).param("standalone", "true")).andExpect(status().isOk()).andExpect(jsonPath("$").isMap());

mvc.perform(get("/api/v2/playlist/recommendation/" + purpose + "/" + mediaURN + ".json")).andExpect(status().isOk()).andExpect(jsonPath("$").isMap());
mvc.perform(get("/api/v2/playlist/recommendation/" + purpose + "/" + mediaURN + ".json").param("standalone", "false")).andExpect(status().isOk()).andExpect(jsonPath("$").isMap());
mvc.perform(get("/api/v2/playlist/recommendation/" + purpose + "/" + mediaURN + ".json").param("standalone", "true")).andExpect(status().isOk()).andExpect(jsonPath("$").isMap());

mvc.perform(get("/api/v2/playlist/recommendation/" + purpose + "/" + mediaURN)).andExpect(status().isOk()).andExpect(isAvailable ? jsonPath("$.urns[0]").value(mediaURN) : jsonPath("$.urns").isEmpty());
mvc.perform(get("/api/v2/playlist/recommendation/" + purpose + "/" + mediaURN).param("standalone", "false")).andExpect(isAvailable ? jsonPath("$.urns[0]").value(mediaURN) : jsonPath("$.urns").isEmpty());
mvc.perform(get("/api/v2/playlist/recommendation/" + purpose + "/" + mediaURN).param("standalone", "true")).andExpect(isAvailable ? jsonPath("$.urns[0]").value(mediaURN) : jsonPath("$.urns").isEmpty());

0 comments on commit 646c681

Please sign in to comment.