Skip to content

Add option to allow resolving non-200 responses #820

@diosmosis

Description

@diosmosis

Currently, using usePromise: true will result in non-200 responses being rejected. When writing failure tests w/ a generator flow control library (like co), this can result in strange looking code, for example:

var client = // ... create Swagger client w/ usePromise: true

it('should respond w/ 404', function * () {
    var response;
    try {
        yield client.widgets.getWidget({ widgetId: 'unknown-id' });
    } catch (r) {
        response = r;
    }

    expect(response.status).to.equal(404);
});

It would be great if there was something like request-promise's simple: false option that lets us get non-200 responses like so:

it('should respond w/ 404', function * () {
    var response = yield client.widgets.getWidget({ widgetId: 'unknown-id' });
    expect(response.status).to.equal(404);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions