Пример #1
0
    def process_response(self, req: Request, resp: Response,
                         resource: BaseResource, req_succeeded: bool):
        self.context.logger.debug(
            f'process_response: {resource} {req.method} {req.path}')

        # Default to 'application/json' if responding with an error message
        if req_succeeded and resp.body:
            # candidates should be sorted by increasing desirability
            preferred = req.client_prefers(
                ('application/json', 'application/scim+json'))
            self.context.logger.debug(
                f'Client prefers content-type {preferred}')
            if preferred is None:
                preferred = 'application/scim+json'
                self.context.logger.debug(
                    f'Default content-type {preferred} used')
            resp.content_type = preferred