mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2025-12-08 20:25:52 +00:00
1.2 KiB
1.2 KiB
Custom Request Libraries
There is another constructor parameter that allows the user to specify their custom request library. To specify the library, simply set the requester property when instantiating a service:
An example can be seen in the Requester.ts file.
import { Gitlab } from '@gitbeaker/rest';
import YourCustomRequester from 'custom-requester';
const api = new Gitlab({
host: 'http://example.com',
token: 'personaltoken',
requester: YourCustomRequester,
});
Handling HTTPS certificates
If your Gitlab server is running via HTTPS, the proper way to pass in your certificates is via a NODE_EXTRA_CA_CERTS environment key, like this:
"scripts": {
"start": "NODE_EXTRA_CA_CERTS=./secrets/3ShapeCA.pem node bot.js"
},
Note
: Using
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'will not work with thegitlablibrary. TherejectUnauthorizedkey is the only way to allow insecure certificates to be bypassed.
Support for Node v16.18+
Since everything builds off fetch support, applying a poly fill will allow for Node v16.18 instead of 18+. ie:
- Install node-fetch
- Set the following in your entry point:
global.fetch = require('node-fetch')