     payload =
       title: @title(event)
       body: @markdownBody(event)
-      # Regex removes surrounding whitespace around commas while retaining inner whitespace
-      # and then creates an array of the strings
-      labels: payloadLabels.trim().split(/\s*,\s*/).compact(true)
+      labels: payloadLabels.split(/\s*,\s*/).compact(true)
 
-    # Start building the request
-    req = @request
-      .post("#{BASE_URL}/repos/#{config.repo}/issues")
-      .timeout(4000)
-      .set("User-Agent", "Bugsnag")
-
-    # Authenticate the request
-    if config.oauthToken
-      req.set("Authorization", "token #{config.oauthToken}")
-    else
-      req.auth(config.username, config.password)
-
-    # Send the request
-    req
+    @githubRequest(@request.post(@issuesUrl(config)), config)
       .send(payload)
       .on "error", (err) ->
         callback(err)

class GithubIssue extends NotificationPlugin
  BASE_URL = "https://api.github.com"

  @receiveEvent: (config, event, callback) ->

    # Create labels variable
    payloadLabels = (config?.labels || "bugsnag")
    # Check App Version Labeling

          number: res.body.number
          url: res.body.html_url

  @receiveEvent: (config, event, callback) ->
    if event?.error?.createdIssue?.number
      @ensureIssueOpen(config, event.error.createdIssue.number, callback)
      @addCommentToIssue(config, event.error.createdIssue.number, @markdownBody(event))
    else
      @openIssue(config, event, callback)

module.exports = GithubIssue
