skygragon / leetcode-cli

A cli tool to enjoy leetcode!
MIT License
3.65k stars 458 forks source link

[ERROR] http error [400] #100

Closed cczhong11 closed 6 years ago

cczhong11 commented 6 years ago

I could use leetcode-cli properly half hours ago. But now it only shows [ERROR] http error [400] with only leetcode show 1. I ensured my network is okay and I have login in my account. I am in US, no GFW problem. If this was just temporary problem, I will close this issue.

jarronshih commented 6 years ago

+1 for the same issue. I could use it yesterday.

[DEBUG] running leetcode.getProblem
[TRACE] REQUEST %s { url: 'https://leetcode.com/graphql',
  headers:
   { Cookie: <hidden>,
     'X-CSRFToken': <hidden>,
     'X-Requested-With': 'XMLHttpRequest',
     Origin: 'https://leetcode.com',
     Referer: 'https://leetcode.com/problems/longest-palindromic-subsequence/description/' },
  json: true,
  body:
   { query: 'query getQuestionDetail($titleSlug: String!) {\n  question(titleSlug: $titleSlug) {\n    content\n    stats\n    codeDefinition\n    sampleTestCase\n    enableRunCode\n    metaData\n    translatedContent\n    discussCategoryId\n  }\n}',
     variables: { titleSlug: 'longest-palindromic-subsequence' },
     operationName: 'getQuestionDetail' },
  callback: [Function],
  method: 'POST' }
[TRACE] REQUEST %s make request https://leetcode.com/graphql
[TRACE] REQUEST %s onRequestResponse https://leetcode.com/graphql 400 { date: 'Sat, 26 May 2018 01:24:26 GMT',
  'content-type': 'application/json',
  'content-length': '130',
  connection: 'close',
  'set-cookie':
   [ '__cfduid=xxxx; expires=Sun, 26-May-19 01:24:26 GMT; path=/; domain=.leetcode.com; HttpOnly',
     'csrftoken=xxxx; expires=Sat, 25-May-2019 01:24:26 GMT; Max-Age=31449600; Path=/; Secure' ],
  vary: 'Cookie',
  'x-frame-options': 'SAMEORIGIN',
  'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
  'x-content-type-options': 'nosniff',
  'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
  server: 'cloudflare',
  'cf-ray': 'xxx' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode.com/graphql
[TRACE] REQUEST %s response end https://leetcode.com/graphql 400 { date: 'Sat, 26 May 2018 01:24:26 GMT',
  'content-type': 'application/json',
  'content-length': '130',
  connection: 'close',
  'set-cookie':
   [ '__cfduid=xxx; expires=Sun, 26-May-19 01:24:26 GMT; path=/; domain=.leetcode.com; HttpOnly',
     'csrftoken=xxx; expires=Sat, 25-May-2019 01:24:26 GMT; Max-Age=31449600; Path=/; Secure' ],
  vary: 'Cookie',
  'x-frame-options': 'SAMEORIGIN',
  'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
  'x-content-type-options': 'nosniff',
  'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
  server: 'cloudflare',
  'cf-ray': 'xxx' }
[TRACE] REQUEST %s end event https://leetcode.com/graphql
[TRACE] REQUEST %s has body https://leetcode.com/graphql 130
[TRACE] REQUEST %s emitting complete https://leetcode.com/graphql
[DEBUG] http error: 400
[ERROR] http error [400]

Maybe there's spec change on leetcode graphql API?

anooprh commented 6 years ago

+1 on the exact same issue !!

caoyuan0816 commented 6 years ago

Same Issue, I'm in China right now. I can submit and test solutions but cannot use show command to download and generate question. It always show http error [400].

si-yao commented 6 years ago

+1 for US user.

jdneo commented 6 years ago

@skygragon May I ask what is the ETA for the new release with this fix?

skygragon commented 6 years ago

@guys, please tryout this latest fix and let me know if the issue is gone for you.

cczhong11 commented 6 years ago

It works for me.

skygragon commented 6 years ago

@jdneo please try the latest release

npm install -g leetcode-cli
jdneo commented 6 years ago

@skygragon The 2.5.2 works perfectly fine! Thank you!