How to pass file name as a parameter to nameko @http GET?

Hello, here I found a construct that i can use to pass the int value to GET request:

@http(‘GET’, ‘/get/int:value’)
def get_method(self, request, value):
return json.dumps({‘value’: value})

Is there a way to pass the file name into GET request such as or similar?

@http(‘GET’, ‘/get/str:filename’)
def get_method(self, request, filename):
return filename

If not then is there and doc or example how to do it? My task is to pass the file name and download it using nameko service.

Thank you!

Your syntax is bit off. Nameko is using werkzeug library for it’s HTTP handlers as described here:

To accept a string you should decorate your get method with something like this:

@http('GET', '/files/<string:filename>')
def get_method(self, request, filename):

Another example:

For your first decorator:
@http('GET', '/getFileContents/<string:file_name>')

your request would be:
$ curl

not sure where grab path part came from…

Thank you for your help! Got it working.