{"id":18657766,"url":"https://github.com/lightsofapollo/superagent-promise","last_synced_at":"2025-04-06T07:13:52.088Z","repository":{"id":13616033,"uuid":"16309186","full_name":"lightsofapollo/superagent-promise","owner":"lightsofapollo","description":"Simple/dumb promise wrapper for superagent ","archived":false,"fork":false,"pushed_at":"2018-06-04T14:36:25.000Z","size":396,"stargazers_count":129,"open_issues_count":7,"forks_count":27,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T06:07:20.728Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightsofapollo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-28T10:50:27.000Z","updated_at":"2024-03-19T11:23:49.000Z","dependencies_parsed_at":"2022-09-10T13:41:29.430Z","dependency_job_id":null,"html_url":"https://github.com/lightsofapollo/superagent-promise","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fsuperagent-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fsuperagent-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fsuperagent-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fsuperagent-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightsofapollo","download_url":"https://codeload.github.com/lightsofapollo/superagent-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445672,"owners_count":20939959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T07:29:48.911Z","updated_at":"2025-04-06T07:13:52.072Z","avatar_url":"https://github.com/lightsofapollo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://img.shields.io/travis/lightsofapollo/superagent-promise/master.svg)](https://travis-ci.org/lightsofapollo/superagent-promise)\n\nsuperagent-promise\n==================\n\nSimple/dumb promise wrapper for superagent. You must depend on `superagent` and your favorite Promise library directly.\n\n\n## Usage\n\n```js\nvar Promise = this.Promise || require('promise');\nvar agent = require('superagent-promise')(require('superagent'), Promise);\n\n// method, url form with `end`\nagent('GET', 'http://google.com')\n  .end()\n  .then(function onResult(res) {\n    // do stuff\n  }, function onError(err) {\n    //err.response has the response from the server\n  });\n\n// method, url form with `then`\nagent('GET', 'http://google.com')\n  .then(function onResult(res) {\n    // do stuff\n  });\n\n\n// helper functions: options, head, get, post, put, patch, del\nagent.put('http://myxfoo', 'data')\n  .end()\n  .then(function(res) {\n    // do stuff`\n  });\n\n// helper functions: options, head, get, post, put, patch, del\nagent.put('http://myxfoo', 'data').\n  .then(function(res) {\n    // do stuff\n  });\n```\n\n## Mocking\n\nNow superagent-promise can be mocked using `superagent-mock`. For the complete example see\n`test/mock.spec.js` and `test/mock.config.js`.\n\n```js\nvar SUCCESS_BODY = 'Yay! Mocked :)';\nvar mockedRequest = require('superagent');\nvar mocks = require('./mock.config')('localhost', SUCCESS_BODY);\nrequire('superagent-mock')(mockedRequest, mocks);\nvar request = require('../index')(mockedRequest, Promise);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsofapollo%2Fsuperagent-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightsofapollo%2Fsuperagent-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsofapollo%2Fsuperagent-promise/lists"}