-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Atlas Streams
-
Sprint 61, Sprint 62
Context
We should allow users to define path, query parameters and fragments in the URL they've statically defined in the connection.
We should add validations that ensure that the URL is valid and that the user does not define urlPath, or parameters in the pipeline which may override the already-defined path, query params, and fragments of the connection's url.
See the BNF linked in RFC3986 for the formal definition of URL syntax.
https://www.rfc-editor.org/rfc/rfc3986#appendix-A
Suggested Implementation
We should implement a helper that parses scheme, username, password, hostname, port, path, query and fragments from an input string.
By doing this, making the necessary validations should be relatively straightforward.
as a driveby, we need to make sure to encode the connection URL. See the TODO(SERVER-96880) comment.
Desired Behavior Examples
Example 1: conflicting paths
connectionUrl = https://foo.com/bar?foo=bar
operator.urlPath = "/foo/bar"
=> we should return an error
Example 2: conflicting params
connectionUrl = https://foo.com/bar#fragment
operator.parameters = {foo: "bar"}
=> we should return an error
Example 3: conflicting path
connectionUrl = https://foo.com#fragment
operator.urlPath = "/foo/bar"
=> we should return an error
Example 4: append operator params to connection url
connectionUrl = https://foo.com?foo=bar
operator.parameters = {bar: "baz"}
=> we should append the parameter and make the request Url https://foo.com?foo=bar&bar=baz
Example 5: malformed url
connectionUrl = https://foobar baz
=> we should return an error
- is duplicated by
-
SERVER-96751 Add stricter validation on connection URLs in $externalApi
- Closed