Trax-air / swagger-tester

Automatically test your swagger API
MIT License
104 stars 36 forks source link

URLs contain base path twice #22

Closed zhichuny closed 8 years ago

zhichuny commented 8 years ago

It seems like the operations generated from swagger parser already contains base path:

def get_paths_data(self):
        """Get data for each paths in the swagger specification.
        Get also the list of operationId.
        """
        for path, path_spec in self.specification['paths'].items():
            path = u'{0}{1}'.format(self.base_path, path)

However, in swagger_tester, before making request, it combines base path with what we got from swagger_parser again:

def get_url_body_from_request(action, path, request_args, swagger_parser):
    """Get the url and the body from an action, path, and request args.
    Args:
        action: HTTP action.
        path: path of the request.
        request_args: dict of args to send to the request.
        swagger_parser: instance of swagger parser.
    Returns:
        url, body, headers, files
    """
    url = u'{0}{1}'.format(swagger_parser.base_path, path)

So when making the request, url will be like: /v1/v1/path/to/api

cyprieng commented 8 years ago

Yes, you are right. It is because of a recent update of swagger_parser. I will fix it.