You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently trying to use the rankIssues(body) method as follows:
// code exists inside a function that answers an HTTP-requestconstjiraClient=newJiraApi({ ... });constrankRequestBody={issues: ['ISSUE-10'],rankBeforeIssue: 'ISSUE-12',rankCustomFieldId: 10057,};returnjiraClient.rankIssues(rankRequestBody);
The rankIssues call fails with the following reason:
Error: Can not instantiate value of type [simple type, class com.atlassian.greenhopper.api.rest.bean.IssueRankRequestBean] from JSON String; no single-String constructor/factory method
at JiraApi.doRequest (/path/to/project/node_modules/jira-client/lib/jira.js:333:15)
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 without stringifying it (or changing the expected type to object in the corresponding type-declaration), the call works. 🎉
Is the expected body something different than the stringified request-body, or is this a typing issue?
EDIT:
Intercepted the doRequest() method and inspected the options before they are submitted.
When passing `rankRequestBody` as `object` (--> request works):
Hello there 👋
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. 🎉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):
When passing `rankRequestBody` as `string`ified version (as noted in comments and types; --> request fails):
The text was updated successfully, but these errors were encountered: