Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random 302 Moved Temporarily errors #30

Open
tiagorangel1 opened this issue Jan 31, 2024 · 0 comments
Open

Random 302 Moved Temporarily errors #30

tiagorangel1 opened this issue Jan 31, 2024 · 0 comments

Comments

@tiagorangel1
Copy link

When trying to fetch too much journeys, it is possible to get the following error:

const error = new HTTPError(response, options);
              ^

GotError [HTTPError]: Response code 302 (Moved Temporarily)
    at EventEmitter.<anonymous> (<path>\node_modules\got\source\as-promise.js:74:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  host: 'api.cp.pt',
  hostname: 'api.cp.pt',
  method: 'POST',
  path: '/cp-api/oauth/token',
  socketPath: undefined,
  protocol: 'https:',
  url: 'https://api.cp.pt/cp-api/oauth/token',
  gotOptions: {
    path: '/cp-api/oauth/token',
    protocol: 'https:',
    slashes: true,
    auth: null,
    host: 'api.cp.pt',
    port: null,
    hostname: 'api.cp.pt',
    hash: null,
    search: null,
    query: null,
    pathname: '/cp-api/oauth/token',
    href: 'https://api.cp.pt/cp-api/oauth/token',
    retry: {
      retries: [Function (anonymous)],
      methods: Set(6) { 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' },
      statusCodes: Set(7) { 408, 413, 429, 500, 502, 503, 504 },
      errorCodes: Set(8) {
        'ETIMEDOUT',
        'ECONNRESET',
        'EADDRINUSE',
        'ECONNREFUSED',
        'EPIPE',
        'ENOTFOUND',
        'ENETUNREACH',
        'EAI_AGAIN'
      }
    },
    headers: {
      'user-agent': 'got/9.6.0 (https://github.com/sindresorhus/got)',
      accept: 'application/json',
      authorization: 'Basic <removed>',
      'content-type': 'application/x-www-form-urlencoded',
      'accept-encoding': 'gzip, deflate',
      'content-length': 29
    },
    hooks: {
      beforeRequest: [],
      beforeRedirect: [],
      beforeRetry: [],
      afterResponse: [],
      beforeError: [],
      init: []
    },
    decompress: true,
    throwHttpErrors: true,
    followRedirect: true,
    stream: false,
    form: false,
    json: false,
    cache: false,
    useElectronNet: false,
    body: 'grant_type=client_credentials',
    method: 'POST'
  },
  statusCode: 302,
  statusMessage: 'Moved Temporarily',
  headers: {
    server: 'nginx',
    date: 'Wed, 31 Jan 2024 08:54:31 GMT',
    'content-type': 'text/html',
    'content-length': '138',
    connection: 'close',
    location: 'https://www.cp.pt',
    'front-end-https': 'on',
    'strict-transport-security': 'max-age=31536000; includeSubdomains',
    'x-frame-options': 'DENY',
    'x-content-type-options': 'nosniff'
  },
  body: '<html>\r\n' +
    '<head><title>302 Found</title></head>\r\n' +
    '<body>\r\n' +
    '<center><h1>302 Found</h1></center>\r\n' +
    '<hr><center>nginx</center>\r\n' +
    '</body>\r\n' +
    '</html>\r\n'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant