Skip to content

Generating Castle Client from request doesn't set proper context #109

@sobrle

Description

@sobrle

We found scenario (in version 6.0.0) in which some combination of options params causes client to be created without context that is retrieved from request.

In method: castle.client.Client.from_request with second parameter options like this:
options = {'context': {'some_key': 'some_value'}}
after proper merging of context from options parameter and context from request headers, params options after merging will not be updated to merged values because in this case this statement:
options.setdefault('context', ContextPrepare.call(request, options))
will not have any effect - it will leave options[‘context’] as it were passed to functions since key exists in this dict.
We suggest to use options['context'] = ContextPrepare.call(request, options) since this key needs to be set to new value.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions