Fix the payload used to add a label to an issue
This commit is contained in:
@@ -127,10 +127,8 @@ public class GitHubTemplate implements GitHubOperations {
|
||||
|
||||
@Override
|
||||
public Issue addLabel(Issue issue, String labelName) {
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("labels", Arrays.asList(labelName));
|
||||
ResponseEntity<Label[]> response = this.rest.exchange(
|
||||
new RequestEntity<>(body, HttpMethod.POST,
|
||||
new RequestEntity<>(Arrays.asList(labelName), HttpMethod.POST,
|
||||
URI.create(issue.getLabelsUrl().replace("{/name}", ""))),
|
||||
Label[].class);
|
||||
if (response.getStatusCode() != HttpStatus.OK) {
|
||||
|
||||
@@ -159,8 +159,8 @@ public class GitHubTemplateTests {
|
||||
@Test
|
||||
public void addLabelToIssue() {
|
||||
this.server.expect(requestTo("labelsUrl")).andExpect(method(HttpMethod.POST))
|
||||
.andExpect(basicAuth())
|
||||
.andExpect(content().string("{\"labels\":[\"test\"]}")).andRespond(
|
||||
.andExpect(basicAuth()).andExpect(content().string("[\"test\"]"))
|
||||
.andRespond(
|
||||
withSuccess("[{\"name\":\"test\"}]", MediaType.APPLICATION_JSON));
|
||||
Issue issue = new Issue("issueUrl", null, null, "labelsUrl{/name}", null, null,
|
||||
null, null);
|
||||
|
||||
Reference in New Issue
Block a user