Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentSecurityPolicy builders should be discardable results #19

Closed
0xTim opened this issue Jan 2, 2020 · 0 comments · Fixed by #21
Closed

ContentSecurityPolicy builders should be discardable results #19

0xTim opened this issue Jan 2, 2020 · 0 comments · Fixed by #21

Comments

@0xTim
Copy link
Member

0xTim commented Jan 2, 2020

Since ContentSecurityPolicy is a class and the various functions affect the store policies, they should all be marked with @discardableResult. This allows you to do things like:

let csp = ContentSecurityPolicy = ContentSecurityPolicy().defaultSrc("self")

if env == .production {
  csp.blockAllMixedContent()
}

This currently works but produces a warning since you aren't using the result of blockAllMixedContent.

@0xTim 0xTim linked a pull request Apr 10, 2020 that will close this issue
2 tasks
@0xTim 0xTim closed this as completed in #21 Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant