yocontra / nodecast

Node interface to DIAL/RAMP/ChromeCast
MIT License
163 stars 23 forks source link

Bad Request #23

Closed joaopedro5g closed 3 weeks ago

joaopedro5g commented 3 years ago

My app is not connect with my smart tv(is Samsung) why? returning bad request error 400

arantesxyz commented 2 years ago

Same here, I think it's a different device implementation, trying to find the Samsung docs.

Error: Bad Request
    at Request.callback (/Users/arantes/projects/cast2/node_modules/superagent/lib/node/index.js:706:15)
    at IncomingMessage.<anonymous> (/Users/arantes/projects/cast2/node_modules/superagent/lib/node/index.js:916:18)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1334:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
 {
  status: 400,
  response: <ref *1> Response {
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    _maxListeners: undefined,
    res: IncomingMessage {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      socket: [Socket],
      httpVersionMajor: 1,
      httpVersionMinor: 0,
      httpVersion: '1.0',
      complete: true,
      headers: [Object],
      rawHeaders: [Array],
      trailers: {},
      rawTrailers: [],
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 400,
      statusMessage: 'Bad Request ',
      client: [Socket],
      _consuming: false,
      _dumped: false,
      req: [ClientRequest],
      text: '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>402</errorCode><errorDescription>Invalid Args</errorDescription></UPnPError></detail></s:Fault></s:Body></s:Envelope>',
      [Symbol(kCapture)]: false,
      [Symbol(RequestTimeout)]: undefined
    },
    request: Request {
      _events: [Object: null prototype] {},
      _eventsCount: 0,
      _maxListeners: undefined,
      _agent: false,
      _formData: null,
      method: 'POST',
      url: 'http://192.168.15.2:7678/ws/app/YouTube',
      _header: [Object],
      header: [Object],
      writable: true,
      _redirects: 0,
      _maxRedirects: 5,
      cookies: '',
      qs: {},
      _query: [],
      qsRaw: [],
      _redirectList: [],
      _streamRequest: false,
      _buffer: true,
      _data: 'v=d_HlPboLRL8',
      req: [ClientRequest],
      protocol: 'http:',
      host: '192.168.15.2:7678',
      _endCalled: true,
      _callback: [Function (anonymous)],
      res: [IncomingMessage],
      response: [Circular *1],
      called: true,
      [Symbol(kCapture)]: false
    },
    req: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 13,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [Socket],
      _header: 'POST /ws/app/YouTube HTTP/1.1\r\n' +
        'Host: 192.168.15.2:7678\r\n' +
        'Accept-Encoding: gzip, deflate\r\n' +
        'User-Agent: node-superagent/3.8.3\r\n' +
        'Content-Type: text/plain\r\n' +
        'Content-Length: 13\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/ws/app/YouTube',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: '192.168.15.2',
      protocol: 'http:',
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    text: '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>402</errorCode><errorDescription>Invalid Args</errorDescription></UPnPError></detail></s:Fault></s:Body></s:Envelope>',
    body: {},
    files: undefined,
    buffered: true,
    headers: {
      'content-type': 'text/xml; charset="utf-8"',
      server: 'UPnP/1.1 Samsung AllShare Server/1.0',
      'content-length': '417'
    },
    header: {
      'content-type': 'text/xml; charset="utf-8"',
      server: 'UPnP/1.1 Samsung AllShare Server/1.0',
      'content-length': '417'
    },
    statusCode: 400,
    status: 400,
    statusType: 4,
    info: false,
    ok: false,
    redirect: false,
    clientError: true,
    serverError: false,
    error: Error: cannot POST /ws/app/YouTube (400)
        at Response.toError (/Users/arantes/projects/cast2/node_modules/superagent/lib/node/response.js:94:15)
        at ResponseBase._setStatusProperties (/Users/arantes/projects/cast2/node_modules/superagent/lib/response-base.js:123:16)
        at new Response (/Users/arantes/projects/cast2/node_modules/superagent/lib/node/response.js:41:8)
        at Request._emitResponse (/Users/arantes/projects/cast2/node_modules/superagent/lib/node/index.js:752:20)
        at IncomingMessage.<anonymous> (/Users/arantes/projects/cast2/node_modules/superagent/lib/node/index.js:916:38)
        at IncomingMessage.emit (events.js:412:35)
        at endReadableNT (internal/streams/readable.js:1334:12)
        at processTicksAndRejections (internal/process/task_queues.js:82:21) {
      status: 400,
      text: '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>402</errorCode><errorDescription>Invalid Args</errorDescription></UPnPError></detail></s:Fault></s:Body></s:Envelope>',
      method: 'POST',
      path: '/ws/app/YouTube'
    },
    created: false,
    accepted: false,
    noContent: false,
    badRequest: true,
    unauthorized: false,
    notAcceptable: false,
    forbidden: false,
    notFound: false,
    unprocessableEntity: false,
    type: 'text/xml',
    charset: '"utf-8"',
    links: {},
    setEncoding: [Function: bound ],
    redirects: [],
    [Symbol(kCapture)]: false
  }
}