eclipse-vertx / eclipse-vertx/vert.x

Expose containsValue method on the MultiMap interface

Open
#5,089 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
14.7k
Forks
2.1k
Avg merge
2d 7h
Merged PRs (30d)
28

Description

#### Describe the feature

The `containsValue(name, value, ...)` method in [HeadersMultiMap](https://github.com/eclipse-vertx/vert.x/blob/244b91045bb166625b2645bfdc95ede825c133a3/src/main/java/io/vertx/core/http/impl/headers/HeadersMultiMap.java#L226) is meant to check the existence of a value in a multi values key/header.

I'll be useful to expose this method into the `MultiMap` interface: check for a sub-value (for now, only the `contains` method is defined, which only checks for value equality)

This will help with checks on the `Connection` header for websocket upgrades e.g. given that Firefox sends `Connection: keep-alive, Upgrade` instead of `Connection: Upgrade`. It would prevent re-implementingthat in different places, for example:

- vertx-web: https://github.com/vert-x3/vertx-web/blob/9e3a783b1d1a731055e9049078b1b1494ece9c15/vertx-web/src/main/java/io/vertx/ext/web/impl/Utils.java#L235-L255
- vertx: https://github.com/eclipse-vertx/vert.x/blob/244b91045bb166625b2645bfdc95ede825c133a3/src/main/java/io/vertx/core/http/impl/Http1xServerConnection.java#L359-L365
- vertx: https://github.com/eclipse-vertx/vert.x/blob/244b91045bb166625b2645bfdc95ede825c133a3/src/main/java/io/vertx/core/http/impl/Http1xUpgradeToH2CHandler.java#L52-L75 (maybe allow`containsValue` to look for different values on the same loop.)
- vertx: https://github.com/eclipse-vertx/vert.x/blob/244b91045bb166625b2645bfdc95ede825c133a3/src/main/java/io/vertx/core/http/impl/HttpUtils.java#L971-L974
- vertx-http-proxy: https://github.com/eclipse-vertx/vertx-http-proxy/blob/7a139fc609904675df5c9cb68b4d5c253b899648/src/main/java/io/vertx/httpproxy/impl/ReverseProxy.java#L85-L90 (see: )
- It'll be useful for other consumers as well.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.