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

Simplify gzip feature cfg #405

Merged
merged 1 commit into from
Feb 8, 2021
Merged

Simplify gzip feature cfg #405

merged 1 commit into from
Feb 8, 2021

Conversation

kazk
Copy link
Member

@kazk kazk commented Feb 8, 2021

No description provided.

@clux
Copy link
Member

clux commented Feb 8, 2021

ah, i was considering suggesting using identitylayer to avoid it, but this is obviously better :-)
EDIT: oh, that was for the optional auth branch.

@clux clux merged commit 1c04574 into kube-rs:master Feb 8, 2021
@kazk
Copy link
Member Author

kazk commented Feb 8, 2021

EDIT: oh, that was for the optional auth branch.

Like this?

let inner = ServiceBuilder::new()
    .layer(common)
    .layer(if let Authentication::RefreshableToken(refreshable) = auth {
        AuthLayer::new(refreshable)
    } else {
        Identity::new()
    })
    .layer(tower::layer::layer_fn(LogRequest::new))
    .service(client);
Ok(Self::new(inner))

This won't compile because if and else have different types.

Maybe there's a better way, but I think it's fine for now if not.

@kazk kazk deleted the simplify-gzip-cfg branch February 8, 2021 10:28
@clux
Copy link
Member

clux commented Feb 8, 2021

yeah, that's what i was thinking, but if it doesn't work it's not a problem.
makes sense that it doesn't, quite different layer requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants