Access HTTP Headers In Zope Python

I am sending a URLRequest to Zope 5 from a swift based iOS app. I do this all the time with JSON and there's no issue, accessing the body with context.REQUEST["BODY"], but in this app I am not sending JSON, I am sending a bunch of HTTP headers and the Body is a raw message pack binary.

If I do

name = context.REQUEST["HTTP_X_MY_NAME"]

if name == 'Fred':

I get an error that if failed, even though I have verified that the HTTP_X_MY_NAME header is set to Fred. I'm even tried with strip().lower() just in case and that didn't solve it. Am I accessing the HTTP Header incorrectly?

You use the text() message of the request object for printing it (on the console).
But your approach appears right.

So it is context.REQUEST["HTTP_X_MY_NAME"] right?

The HTTPRequest object has a getHeader method — use that, and consult ZPublisher.HTTPRequest source if you have any questions about calling semantics.