Open Andr3wid opened 2 years ago
I came to report the same issue but instead I will :+1: this
my workaround was to do this
const body = {
rankBeforeIssue: page.issues[0].key,
issues: [issueKey],
};
return jira.rankIssues(body as unknown as string)
I'm under the impression that it's intended to be passed as a string since the jsdoc indicates that here: https://github.com/jira-node/node-jira-client/blob/9dc7c187271077dc98ff316fbd9e4b9dbb271508/src/jira.js#L1852
Hello there :wave:
I'm currently trying to use the
rankIssues(body)
method as follows:The
rankIssues
call fails with the following reason:The error seems to indicate that the request-body is malformed according to this source. The exact same request-body works when submitted through postman though. After some digging, it seems that the request body gets stringified twice or something. Indeed if I directly pass
rankRequestBody
withoutstringify
ing it (or changing the expected type toobject
in the corresponding type-declaration), the call works. :tada:Is the expected
body
something different than the stringified request-body, or is this a typing issue?EDIT: Intercepted the
doRequest()
method and inspected theoptions
before they are submitted.When passing `rankRequestBody` as `object` (--> request works):
```json { "auth": { /* Auth related stuff */ }, "rejectUnauthorized": true, "method": "PUT", "uri": "https://my-base-uri.xyz/rest/agile/1.0/issue/rank", "json": true, "body": { "issues": ["ISSUE-10"], "rankBeforeIssue": "ISSUE-12", "rankCustomFieldId":10057 } } ```When passing `rankRequestBody` as `string`ified version (as noted in comments and types; --> request fails):
```json { "auth": { /* Auth related stuff */ }, "rejectUnauthorized": true, "method": "PUT", "uri": "https://my-base-uri.xyz/rest/agile/1.0/issue/rank", "json": true, "body": "{\"issues\":[\"ISSUE-10\"],\"rankBeforeIssue\":\"ISSUE-12\",\"rankCustomFieldId\":10057}" } ```