-
Notifications
You must be signed in to change notification settings - Fork 414
Description
When using the Transition class I get an http error while trying to fetch the json from API:
/Library/Ruby/Gems/2.3.0/gems/jira-ruby-1.5.0/lib/jira/request_client.rb:16:in `request': JIRA::HTTPError
I added some debugging to the request_client.rb and managed to find out a sensible difference in between successful requests:
get: /rest/api/2/search?jql=[...my_query...] - []
and the unsuccessful one:
get: https://my.host.name/jira/rest/api/2/issue/179217/transitions?expand=transitions.fields - []
/Library/Ruby/Gems/2.3.0/gems/jira-ruby-1.5.0/lib/jira/request_client.rb:16:in `request': JIRA::HTTPError
I suspect the get call under def request() in:
https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/client.rb#L226-L229
is erroneously getting the full url rather than the path it expects (e.g. starting from the rest path)
Upon further investigation I found that the Transition class definition in
https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/resource/transition.rb#L23
uses #{issue.self} to build the path, whereas most other classes (see:
https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/resource/issue.rb#L94 or
https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/resource/attachment.rb#L19 or
https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/resource/user.rb#L7
just to name a few) use #{client.options[:rest_base_path]} instead.
I have seen at least other 2 places where the url is built with #{issue.self}
(https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/resource/watcher.rb#L22 and
https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/resource/remotelink.rb#L20).
I guess those 2 would produce the same error.