Skip to content

Conversation

@rbapat
Copy link

@rbapat rbapat commented Apr 7, 2025

Before this PR

Request objects do not copy over query parameters when the builder is created from an existing object

After this PR

==COMMIT_MSG==
When request objects are created using a builder on an existing object, query parameters will be copied over from the previous object to match the headers and path params implementation

==COMMIT_MSG==

@changelog-app
Copy link

changelog-app bot commented Apr 7, 2025

Generate changelog in changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

When request objects are created using a builder on an existing object, query parameters will be copied over from the previous object to match the headers and path params implementation

Check the box to generate changelog(s)

  • Generate changelog entry

Comment on lines +310 to +315
ListMultimap<String, String> mutable =
Multimaps.newListMultimap(new LinkedHashMap<>(), MAP_VALUE_FACTORY);
if (!queryParams.isEmpty()) {
queryParams.forEach(mutable::put);
}
queryParams = mutable;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a test case that would fail before and now succeeds as a result of this change

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added!

@ash211 ash211 requested a review from carterkozak April 8, 2025 21:39
@stale
Copy link

stale bot commented Jun 27, 2025

This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days.

@stale stale bot added the stale label Jun 27, 2025
@ash211 ash211 requested review from schlosna and removed request for carterkozak July 7, 2025 16:47
@stale stale bot removed the stale label Jul 7, 2025
Comment on lines +99 to +116
.putQueryParams("query1", "queryVal1")
.putHeaderParams("header1", "headerVal1")
.putPathParams("path1", "pathVal1")
.build();

Request newRequest = Request.builder()
.from(oldRequest)
.putQueryParams("query2", "queryVal2")
.putHeaderParams("header2", "headerVal2")
.putPathParams("path2", "pathVal2")
.build();

// make sure new query/header/path parameters were added in addition to whatever was in `oldRequest`
assertThat(newRequest)
.extracting(Request::queryParams)
.extracting(Multimap::entries, collection(Map.Entry.class))
.containsExactlyInAnyOrder(
MapEntry.entry("query1", "queryVal1"), MapEntry.entry("query2", "queryVal2"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to also test unique query param in each of old & new requests as well as duplicate query param names (since they're a ListMultimap)

@stale
Copy link

stale bot commented Oct 18, 2025

This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days.

@stale stale bot added the stale label Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants