How to use the hyperswitch.HTTPError function in hyperswitch

To help you get started, we’ve selected a few hyperswitch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikimedia / restbase / v1 / lists.js View on Github external
try {
                continuation = JSON.parse(continuation);
                // Make sure nothing malicious can be done by splicing the continuation data
                // into the API parameters.
                const allowedKeys = ['continue', 'rlcontinue', 'rlecontinue'];
                for (const key of allowedKeys) {
                    if (typeof continuation[key] !== 'object') {
                        sanitizedContinuation[key] = continuation[key];
                    }
                }
            } catch (e) {
                this.options.logger.log('error/unflatten', {
                    msg: e.message,
                    json: continuation
                });
                throw new HyperSwitch.HTTPError({
                    status: 400,
                    body: {
                        type: 'server_error#invalid_paging_parameter',
                        title: 'Invalid paging parameter',
                        parameter: continuation
                    }
                });
            }
        }
        return sanitizedContinuation;
    }

hyperswitch

REST API creation framework

Apache-2.0
Latest version published 4 years ago

Package Health Score

46 / 100
Full package analysis