# screwdriver-request

> Wrapper around got pkg to define a simple interface for http requests

Latest version **3.0.0** (published 2025-02-14) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install screwdriver-request
pnpm add screwdriver-request
yarn add screwdriver-request
bun add screwdriver-request
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2025-02-14 |
| First published | 2021-07-23 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Tiffany Kyi |
| Maintainers | screwdriver |
| Keywords | screwdriver, yahoo |

## Links

- npm: https://www.npmjs.com/package/screwdriver-request
- Repository: https://github.com/screwdriver-cd/request
- Issues: https://github.com/screwdriver-cd/screwdriver/issues
- npm.io page: https://npm.io/package/screwdriver-request

## Dependencies (2)

- [got](https://npm.io/package/got.md) ^11.8.6
- [@hapi/hoek](https://npm.io/package/@hapi/hoek.md) ^11.0.7

## Recent versions

- 3.0.0 (latest) — 2025-02-14
- 2.0.1 — 2022-12-01
- 2.0.0 — 2022-11-29
- 0.1.0 — 2022-02-25
- 1.0.3 — 2021-08-10
- 1.0.2 — 2021-07-30
- 1.0.1 — 2021-07-29
- 1.0.0 — 2021-07-26
- 0.0.1 — 2021-07-23

## README

# request
[![Version][npm-image]][npm-url] ![Downloads][downloads-image] [![Build Status][status-image]][status-url] [![Open Issues][issues-image]][issues-url] ![License][license-image]

> Wrapper around [got pkg](https://github.com/sindresorhus/got) to define a simple interface for http requests

## Usage

```bash
npm install screwdriver-request
```

Example:
```javascript
const Hoek = require('@hapi/hoek');
const logger = require('logger');
const request = require('screwdriver-request');

async _addPrComment({ comment, prNum, scmUri }) {
    try {
        const pullRequestComment = await request({
            method: 'POST',
            url: `https://gitlab.com/v4/projects/${repoId}/merge_requests/${prNum}/notes`,
            json: {
                body: 'This is a comment'
            },
            context: {
                token: this.config.commentUserToken,
                caller: 'createPullRequestComment'
            },
            timeout: 15000
        });
        
        return {
            commentId: Hoek.reach(pullRequestComment, 'body.id'),
            createTime: Hoek.reach(pullRequestComment, 'body.created_at'),
            username: Hoek.reach(pullRequestComment, 'body.author.username')
        };
    } catch (err) {
            logger.error('Failed to addPRComment: ', err);

            return null;
        }
    }
}

```
## Testing

```bash
npm test
```

## License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.

[npm-image]: https://img.shields.io/npm/v/screwdriver-request.svg
[npm-url]: https://npmjs.org/package/screwdriver-request
[downloads-image]: https://img.shields.io/npm/dt/screwdriver-request.svg
[license-image]: https://img.shields.io/npm/l/screwdriver-request.svg
[issues-image]: https://img.shields.io/github/issues/screwdriver-cd/request.svg
[issues-url]: https://github.com/screwdriver-cd/request/issues
[status-image]: https://cd.screwdriver.cd/pipelines/7717/badge
[status-url]: https://cd.screwdriver.cd/pipelines/7717

---
_Source: https://npm.io/package/screwdriver-request · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
