Skip to content
This repository was archived by the owner on Feb 9, 2024. It is now read-only.
This repository was archived by the owner on Feb 9, 2024. It is now read-only.

passing a custom namespace binding will not work #67

Closed
@ashleymichal

Description

@ashleymichal

at the moment in the code we provide an option to set a custom ASSET_NAMESPACE binding, but it appears that we actually never use it.

If we want this option to work, we need to test and verify the following scenarios:

  1. Proof of the bug: Define a kv namespace for both CUSTOM_NAMESPACE and __STATIC_CONTENT. Pass CUSTOM_NAMESPACE in to the function as options.ASSET_NAMESPACE. You would expect to get back the result from CUSTOM_NAMESPACE, but you will actually get back the result from __STATIC_CONTENT.

My working hypothesis is that if the global __STATIC_CONTENT is undefined, this will actually throw an undefined exception in the current code.

  1. I fail to bind anything to the global variable CUSTOM_NAMESPACE, and pass it in as part of the options object under ASSET_NAMESPACE. The kv asset handler should throw an InternalError when it does the typeof check against ASSET_NAMESPACE. I believe this happens with the code right now.

  2. (Control test): I bind a kv namespace to the global __STATIC_CONTENT and do not pass anything in to the options object. The kv asset handler should call .get on the static content object and return the result.

  3. Proof the bug is squashed: run test Remove condition and class - export a single function #1 above. You should get back the response from the CUSTOM_NAMESPACE.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions