Skip to content

Error: Invalid HTTP response: 400 #13

Closed

Description

@k-yle

I get this error when trying your example on my repository:

(node:7604) DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or `Buffer.alloc()` instead.
GET /repos/tgs-bot-ghost/test/git/refs/heads/master 400
Rate limit undefined/undefined left
C:\Users\Kyle\Desktop\js-github\examples\readme-caps.js:39
  var headHash = yield repo.readRef("refs/heads/master");
                            ^

Error: Invalid HTTP response: 400 <!DOCTYPE html>
[...]
    at onRef (C:\Users\Kyle\Desktop\js-github\mixins\github-db.js:284:25)
    at IncomingMessage.<anonymous> (C:\Users\Kyle\Desktop\js-github\lib\xhr-node.js:75:16)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Activity

  1. creationix commented on Jan 12, 2017

    @creationix
    Owner

    Seems related to #12

  2. k-yle commented on Jan 12, 2017

    @k-yle
    ContributorAuthor

    This seams to fix it as far as I can see

    function encodeDate(date) {
      function twoDigit(num) {    
        if (num < 10) return "0" + num;
        return "" + num;
      }
      var neg = "+";
      var seconds = date.seconds - (date.offset) * 60;
      var d = new Date(seconds * 1000);
      var string = d.toISOString();
      var offset = date.offset;
      if (offset <= 0) offset = -offset;
      else neg = "-";
      var hours = (date.offset / 60)|0;
      var minutes = date.offset % 60;
      
      //new stuff
        if (hours <= 0) {
          hours = -(hours);
          neg = '-';
        }
      string = string.substring(0, string.lastIndexOf(".")) +
        neg + twoDigit(hours) + ":" + twoDigit(minutes);
      return string;
    }
  3. creationix commented on Jan 12, 2017

    @creationix
    Owner

    You're welcome to send in a PR

  4. k-yle commented on Jan 13, 2017

    @k-yle
    ContributorAuthor

    Done in #14
    Closing because it's fixed for me now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions