diff --git a/src/api/get.py b/src/api/get.py index 97a6bb9..edc86da 100644 --- a/src/api/get.py +++ b/src/api/get.py @@ -1,6 +1,6 @@ from flask_restx import Namespace, Resource, fields from flask_restx import reqparse -from flask import make_response, abort, request +from flask import make_response, abort, request, Response from minio.commonconfig import Tags from werkzeug.datastructures import FileStorage from api.clientGetter import getClientSafely @@ -103,7 +103,11 @@ class getRandomFile(Resource): if client is None: abort(500, "S3 failed to start") choice = random.choice(tuple(client.getCurrentMemeList())) - return make_response(client.getMeme(choice)) + + response = make_response(client.getMeme(choice)) + response.headers['X-Meme-Name'] = choice + + return response @api.route('/psuedorandom') @api.doc(description="Returns a psuedorandom meme. Will not return the same meme for a set number of requests") @@ -129,5 +133,8 @@ class getRandomFile(Resource): logging.debug("Contents of cache : " + str(self.cache)) - return make_response(client.getMeme(choice)) + response = make_response(client.getMeme(choice)) + response.headers['X-Meme-Name'] = choice + + return response