Friday, 17 April 2015

Jira Webhook






My first try was wrong, because they jira webhook send message via POST:
After I changed my endpoint to POST,  everything fine, and I printed out the HttpRequest object:


Completed in 2.531s at Fri Apr 17 2015 00:56:55 GMT+0100 (BST) - Waiting...
{ _readableState: 
   { objectMode: false,
     highWaterMark: 16384,
     buffer: [],
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: true,
     ended: true,
     endEmitted: true,
     reading: false,
     sync: true,
     needReadable: false,
     emittedReadable: false,
     readableListening: false,
     defaultEncoding: 'utf8',
     ranOut: false,
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null,
     resumeScheduled: false },
  readable: false,
  domain: null,
  _events: { close: [ [Function] ] },
  _maxListeners: undefined,
  socket: 
   { _connecting: false,
     _hadError: false,
     _handle: 
      { fd: 73,
        reading: true,
        owner: [Circular],
        onread: [Function: onread],
        onconnection: null,
        writeQueueSize: 0 },
     _host: null,
     _readableState: 
      { objectMode: false,
        highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: false,
        endEmitted: false,
        reading: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null,
        resumeScheduled: false },
     readable: true,
     domain: null,
     _events: 
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        drain: [Object],
        timeout: [Function],
        error: [Function: socketOnError],
        close: [Object],
        data: [Function: socketOnData] },
     _maxListeners: undefined,
     _writableState: 
      { objectMode: false,
        highWaterMark: 16384,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false },
     writable: true,
     allowHalfOpen: true,
     destroyed: false,
     bytesRead: 5608,
     _bytesDispatched: 0,
     _pendingData: null,
     _pendingEncoding: '',
     server: 
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        _connections: 1,
        _handle: [Object],
        _usingSlaves: false,
        _slaves: [],
        allowHalfOpen: true,
        pauseOnConnect: false,
        httpAllowHalfOpen: false,
        timeout: 120000,
        _connectionKey: '4:null:9000' },
     _idleTimeout: 120000,
     _idleNext: { _idleNext: [Circular], _idlePrev: [Circular] },
     _idlePrev: { _idleNext: [Circular], _idlePrev: [Circular] },
     _idleStart: 22199074,
     parser: 
      { '0': [Function: parserOnHeaders],
        '1': [Function: parserOnHeadersComplete],
        '2': [Function: parserOnBody],
        '3': [Function: parserOnMessageComplete],
        _headers: [],
        _url: '',
        socket: [Circular],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function: parserOnIncoming] },
     _paused: false,
     read: [Function],
     _consuming: true,
     _httpMessage: 
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: true,
        sendDate: true,
        _removedHeader: {},
        _hasBody: true,
        _trailer: '',
        finished: false,
        _hangupClose: false,
        _headerSent: false,
        socket: [Circular],
        connection: [Circular],
        _header: null,
        _headers: [Object],
        _headerNames: [Object],
        req: [Circular],
        locals: {},
        flush: [Function: noop],
        write: [Function],
        end: [Function],
        on: [Function],
        writeHead: [Function: writeHead],
        _livereload: true },
     _peername: { address: '::ffff:127.0.0.1', family: 'IPv6', port: 53961 } },
  connection: 
   { _connecting: false,
     _hadError: false,
     _handle: 
      { fd: 73,
        reading: true,
        owner: [Circular],
        onread: [Function: onread],
        onconnection: null,
        writeQueueSize: 0 },
     _host: null,
     _readableState: 
      { objectMode: false,
        highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: false,
        endEmitted: false,
        reading: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null,
        resumeScheduled: false },
     readable: true,
     domain: null,
     _events: 
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        drain: [Object],
        timeout: [Function],
        error: [Function: socketOnError],
        close: [Object],
        data: [Function: socketOnData] },
     _maxListeners: undefined,
     _writableState: 
      { objectMode: false,
        highWaterMark: 16384,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false },
     writable: true,
     allowHalfOpen: true,
     destroyed: false,
     bytesRead: 5608,
     _bytesDispatched: 0,
     _pendingData: null,
     _pendingEncoding: '',
     server: 
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        _connections: 1,
        _handle: [Object],
        _usingSlaves: false,
        _slaves: [],
        allowHalfOpen: true,
        pauseOnConnect: false,
        httpAllowHalfOpen: false,
        timeout: 120000,
        _connectionKey: '4:null:9000' },
     _idleTimeout: 120000,
     _idleNext: { _idleNext: [Circular], _idlePrev: [Circular] },
     _idlePrev: { _idleNext: [Circular], _idlePrev: [Circular] },
     _idleStart: 22199074,
     parser: 
      { '0': [Function: parserOnHeaders],
        '1': [Function: parserOnHeadersComplete],
        '2': [Function: parserOnBody],
        '3': [Function: parserOnMessageComplete],
        _headers: [],
        _url: '',
        socket: [Circular],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function: parserOnIncoming] },
     _paused: false,
     read: [Function],
     _consuming: true,
     _httpMessage: 
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: true,
        sendDate: true,
        _removedHeader: {},
        _hasBody: true,
        _trailer: '',
        finished: false,
        _hangupClose: false,
        _headerSent: false,
        socket: [Circular],
        connection: [Circular],
        _header: null,
        _headers: [Object],
        _headerNames: [Object],
        req: [Circular],
        locals: {},
        flush: [Function: noop],
        write: [Function],
        end: [Function],
        on: [Function],
        writeHead: [Function: writeHead],
        _livereload: true },
     _peername: { address: '::ffff:127.0.0.1', family: 'IPv6', port: 53961 } },
  httpVersionMajor: 1,
  httpVersionMinor: 1,
  httpVersion: '1.1',
  complete: true,
  headers: 
   { host: 'e9162e6.ngrok.com',
     'x-real-ip': '104.192.140.87',
     'x-forwarded-proto': 'http',
     connection: 'close',
     'content-length': '5095',
     accept: '*/*',
     'content-type': 'application/json; charset=UTF-8',
     'user-agent': 'Atlassian HttpClient 0.20.1 / JIRA-6.4-OD-16-006 (64014) / Default',
     via: '1.1 localhost (Apache-HttpClient/4.3.2 (cache)), 1.1 squid-102-1.sm1.uc-inf.net:3128 (squid/2.6.STABLE21)',
     'x-forwarded-for': '10.128.149.138',
     'cache-control': 'max-age=0' },
  rawHeaders: 
   [ 'Host',
     'e9162e6.ngrok.com',
     'X-Real-IP',
     '104.192.140.87',
     'X-Forwarded-Proto',
     'http',
     'Connection',
     'close',
     'Content-Length',
     '5095',
     'Accept',
     '*/*',
     'Content-Type',
     'application/json; charset=UTF-8',
     'User-Agent',
     'Atlassian HttpClient 0.20.1 / JIRA-6.4-OD-16-006 (64014) / Default',
     'Via',
     '1.1 localhost (Apache-HttpClient/4.3.2 (cache)), 1.1 squid-102-1.sm1.uc-inf.net:3128 (squid/2.6.STABLE21)',
     'X-Forwarded-For',
     '10.128.149.138',
     'Cache-Control',
     'max-age=0' ],
  trailers: {},
  rawTrailers: [],
  _pendings: [],
  _pendingIndex: 0,
  upgrade: false,
  url: '/send/xx?user_id=xxxx&user_key=xxx',
  method: 'POST',
  statusCode: null,
  statusMessage: null,
  client: 
   { _connecting: false,
     _hadError: false,
     _handle: 
      { fd: 73,
        reading: true,
        owner: [Circular],
        onread: [Function: onread],
        onconnection: null,
        writeQueueSize: 0 },
     _host: null,
     _readableState: 
      { objectMode: false,
        highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: false,
        endEmitted: false,
        reading: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null,
        resumeScheduled: false },
     readable: true,
     domain: null,
     _events: 
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        drain: [Object],
        timeout: [Function],
        error: [Function: socketOnError],
        close: [Object],
        data: [Function: socketOnData] },
     _maxListeners: undefined,
     _writableState: 
      { objectMode: false,
        highWaterMark: 16384,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false },
     writable: true,
     allowHalfOpen: true,
     destroyed: false,
     bytesRead: 5608,
     _bytesDispatched: 0,
     _pendingData: null,
     _pendingEncoding: '',
     server: 
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        _connections: 1,
        _handle: [Object],
        _usingSlaves: false,
        _slaves: [],
        allowHalfOpen: true,
        pauseOnConnect: false,
        httpAllowHalfOpen: false,
        timeout: 120000,
        _connectionKey: '4:null:9000' },
     _idleTimeout: 120000,
     _idleNext: { _idleNext: [Circular], _idlePrev: [Circular] },
     _idlePrev: { _idleNext: [Circular], _idlePrev: [Circular] },
     _idleStart: 22199074,
     parser: 
      { '0': [Function: parserOnHeaders],
        '1': [Function: parserOnHeadersComplete],
        '2': [Function: parserOnBody],
        '3': [Function: parserOnMessageComplete],
        _headers: [],
        _url: '',
        socket: [Circular],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function: parserOnIncoming] },
     _paused: false,
     read: [Function],
     _consuming: true,
     _httpMessage: 
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: true,
        sendDate: true,
        _removedHeader: {},
        _hasBody: true,
        _trailer: '',
        finished: false,
        _hangupClose: false,
        _headerSent: false,
        socket: [Circular],
        connection: [Circular],
        _header: null,
        _headers: [Object],
        _headerNames: [Object],
        req: [Circular],
        locals: {},
        flush: [Function: noop],
        write: [Function],
        end: [Function],
        on: [Function],
        writeHead: [Function: writeHead],
        _livereload: true },
     _peername: { address: '::ffff:127.0.0.1', family: 'IPv6', port: 53961 } },
  _consuming: true,
  _dumped: false,
  originalUrl: '/api/PortalMessages/send/xx?user_id=xxxx&user_key=xxx',
  _parsedUrl: 
   { protocol: null,
     slashes: null,
     auth: null,
     host: null,
     port: null,
     hostname: null,
     hash: null,
     search: '?user_id=xxx&user_key=xxx',
     query: 'user_id=xxx&user_key=xxxx',
     pathname: '/send/xx',
     path: '/send/xx?user_id=xxx&user_key=xxx',
     href: '/send/xx?user_id=xxx&user_key=xxx' },
  params: {},
  query: { user_id: 'xxx', user_key: 'xxx' },
  res: 
   { domain: null,
     _events: 
      { prefinish: [Function: resOnFinish],
        finish: [Function: logRequest],
        close: [Function: logRequest] },
     _maxListeners: undefined,
     output: [],
     outputEncodings: [],
     outputCallbacks: [],
     writable: true,
     _last: false,
     chunkedEncoding: false,
     shouldKeepAlive: false,
     useChunkedEncodingByDefault: true,
     sendDate: true,
     _removedHeader: {},
     _hasBody: true,
     _trailer: '',
     finished: false,
     _hangupClose: false,
     _headerSent: false,
     socket: 
      { _connecting: false,
        _hadError: false,
        _handle: [Object],
        _host: null,
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _maxListeners: undefined,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: true,
        destroyed: false,
        bytesRead: 5608,
        _bytesDispatched: 0,
        _pendingData: null,
        _pendingEncoding: '',
        server: [Object],
        _idleTimeout: 120000,
        _idleNext: [Object],
        _idlePrev: [Object],
        _idleStart: 22199074,
        parser: [Object],
        _paused: false,
        read: [Function],
        _consuming: true,
        _httpMessage: [Circular],
        _peername: [Object] },
     connection: 
      { _connecting: false,
        _hadError: false,
        _handle: [Object],
        _host: null,
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _maxListeners: undefined,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: true,
        destroyed: false,
        bytesRead: 5608,
        _bytesDispatched: 0,
        _pendingData: null,
        _pendingEncoding: '',
        server: [Object],
        _idleTimeout: 120000,
        _idleNext: [Object],
        _idlePrev: [Object],
        _idleStart: 22199074,
        parser: [Object],
        _paused: false,
        read: [Function],
        _consuming: true,
        _httpMessage: [Circular],
        _peername: [Object] },
     _header: null,
     _headers: { 'x-powered-by': 'Express' },
     _headerNames: { 'x-powered-by': 'X-Powered-By' },
     req: [Circular],
     locals: {},
     flush: [Function: noop],
     write: [Function],
     end: [Function],
     on: [Function],
     writeHead: [Function: writeHead],
     _livereload: true },
  next: [Function: next],
  body: 
   { timestamp: 1429228642488,
     webhookEvent: 'jira:issue_updated',
     user: 
      { self: 'https://wangpingsx.atlassian.net/rest/api/2/user?username=xxxxx',
        name: 'wangpingsx',
        key: 'wangpingsx',
        emailAddress: 'xxxxx@hotmail.com',
        avatarUrls: [Object],
        displayName: 'peter wang [Administrator]',
        active: true,
        timeZone: 'Europe/London' },
     issue: 
      { id: '10000',
        self: 'https://wangpingsx.atlassian.net/rest/api/2/issue/10000',
        key: 'TES-1',
        fields: [Object] },
     changelog: { id: '10000', items: [Object] } },
  _body: true,
  read: [Function],
  originalMethod: 'POST',
  secret: undefined,
  cookies: {},
  signedCookies: {},
  _startTime: Fri Apr 17 2015 00:57:23 GMT+0100 (BST),
  _remoteAddress: '::ffff:127.0.0.1',
  route: 
   { path: '/send/xx',
     stack: [ [Object] ],
     methods: { post: true } } }
send okkkkkk

POST /api/PortalMessages/send/xx?user_id=xxxxxx&user_key=xxxxxxx 201 623ms - 14b

No comments:

Post a comment