예제 #1
0
def get_post_response(obj, body, content_type, api):
    response = Response(body)
    response.status = HTTP_STATUS_CODES[CODE]
    response.status_code = CODE
    response.headers['location'] = '{api}/{new_id}'.format(api=api, new_id=obj.get_id())
    response.autocorrect_location_header = False
    response.content_type = content_type

    return response
예제 #2
0
def get_post_response(body, content_type, api, obj_id):
    if content_type == 'application/json':
        body = json.dumps(body.__dict__)
    response = Response(body)
    response.status = HTTP_STATUS_CODES[CODE]
    response.status_code = CODE
    response.headers['location'] = '{api}/{new_id}'.format(api=api,
                                                           new_id=obj_id)
    response.autocorrect_location_header = False
    response.content_type = content_type

    return response