       message = ""
       id = ""
       ticket = issue.trim().toUpperCase()
-      fetch("#{jiraUrl}/rest/api/2/issue/#{ticket}", headers: headers)
-      .then (res) ->
-        checkStatus res
-      .then (res) ->
-        parseJSON res
+      fetch "#{jiraUrl}/rest/api/2/issue/#{ticket}"
       .then (json) ->
         id = json.id
         message = """


  priorities = JSON.parse process.env.HUBOT_JIRA_PRIORITIES_MAP if process.env.HUBOT_JIRA_PRIORITIES_MAP

  parseJSON = (response) ->
    return response.json()

  checkStatus = (response) ->
    if response.status >= 200 and response.status < 300
      return response
    else
      error = new Error(response.statusText)
      error.response = response
      throw error

  lookupSlackUser = (username) ->
    users = robot.brain.users()

    [ __, ticket, toState ] = msg.match
    ticket = ticket.toUpperCase()

    fetch "#{jiraUrl}/rest/api/2/issue/#{ticket}?expand=transitions.fields"
    .then (json) ->
      type = _(transitions).find (type) -> type.name is toState
      transition = json.transitions.find (state) -> state.to.name.toLowerCase() is type.jira.toLowerCase()
      if transition
        msg.send "<@#{msg.message.user.id}> Transitioning `#{ticket}` to `#{transition.to.name}`"
        fetch "#{jiraUrl}/rest/api/2/issue/#{ticket}/transitions",
          method: "POST"
          body: JSON.stringify
            transition:
