{"id":16485351,"url":"https://github.com/morganconrad/parse-retry-after","last_synced_at":"2025-04-04T17:49:20.581Z","repository":{"id":33098722,"uuid":"150476180","full_name":"MorganConrad/parse-retry-after","owner":"MorganConrad","description":"Parses an HTTP Retry-After header and returns delay time in seconds.","archived":false,"fork":false,"pushed_at":"2023-01-07T04:30:46.000Z","size":153,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T08:49:29.136Z","etag":null,"topics":["headers","http","javascript","retry-after"],"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/MorganConrad.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":"2018-09-26T19:03:57.000Z","updated_at":"2021-05-10T23:13:48.000Z","dependencies_parsed_at":"2023-01-14T23:21:18.573Z","dependency_job_id":null,"html_url":"https://github.com/MorganConrad/parse-retry-after","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorganConrad%2Fparse-retry-after","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorganConrad%2Fparse-retry-after/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorganConrad%2Fparse-retry-after/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorganConrad%2Fparse-retry-after/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MorganConrad","download_url":"https://codeload.github.com/MorganConrad/parse-retry-after/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226195,"owners_count":20904465,"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":["headers","http","javascript","retry-after"],"created_at":"2024-10-11T13:25:31.757Z","updated_at":"2025-04-04T17:49:20.551Z","avatar_url":"https://github.com/MorganConrad.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://secure.travis-ci.org/MorganConrad/parse-retry-after.png)](http://travis-ci.org/MorganConrad/parse-retry-after)\n[![License](http://img.shields.io/badge/license-MIT-A31F34.svg)](https://github.com/MorganConrad/parse-retry-after)\n[![NPM Downloads](http://img.shields.io/npm/dm/parse-retry-after.svg)](https://www.npmjs.org/package/parse-retry-after)\n[![Known Vulnerabilities](https://snyk.io/test/github/morganconrad/parse-retry-after/badge.svg)](https://snyk.io/test/github/morganconrad/parse-retry-after)\n[![Coverage Status](https://coveralls.io/repos/github/MorganConrad/parse-retry-after/badge.svg)](https://coveralls.io/github/MorganConrad/parse-retry-after)\n\n\n\n# parse-retry-after\n\n### Parses an HTTP Retry-After header and returns delay time in seconds.\n\n- If there is no Retry-After header, returns 0\n- If there is, returns **seconds** to delay, rounding up, **minimum 1**\n- If Retry-After header is not an integer or a Date, (should not happen) throws an Error.\n\n### Usage  (very rough, your code will differ!)\n\n    const parse_retry_after = require('parse-retry-after');  // or import...\n\n    fetch(URL, init)\n      .then(function(response) {\n        // probably want to save response somewhere somehow...\n        // check response.status\n        if (mightBeARetry) {\n           let delaySeconds = parse_retry_after(response);\n           if (delaySeconds) {\n              //delay and call fetch again...\n           }\n        }\n        else {\n          // normal \"happy path\" code\n        }\n      })\n\n\n### Todos\n\n 1. Currently uses `module.exports`, should probably use ES6 `export`\n\n - see parse-retry-after6.mjs   for first pass at an ES6 export.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorganconrad%2Fparse-retry-after","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorganconrad%2Fparse-retry-after","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorganconrad%2Fparse-retry-after/lists"}