Skip to content

fix: normalize namespace trailing slash in RESTAPIRepository#421

Merged
dcalhoun merged 2 commits intotrunkfrom
jkmassel/namespace-trailing-slash
Apr 3, 2026
Merged

fix: normalize namespace trailing slash in RESTAPIRepository#421
dcalhoun merged 2 commits intotrunkfrom
jkmassel/namespace-trailing-slash

Conversation

@jkmassel
Copy link
Copy Markdown
Contributor

@jkmassel jkmassel commented Apr 3, 2026

Summary

  • Normalizes the namespace string (e.g. sites/123) to always include a trailing slash before appending paths in RESTAPIRepository
  • Without this, namespaces without a trailing slash produce malformed URLs like sites/123posts/1 instead of sites/123/posts/1
  • Adds tests on both Android and iOS to verify namespace URL construction

Extracted from #316.

Test plan

  • Verify Android unit tests pass (RESTAPIRepositoryTest)
  • Verify iOS unit tests pass (RESTAPIRepositoryTests)

🤖 Generated with Claude Code

@github-actions github-actions bot added the [Type] Bug An existing feature does not function as intended label Apr 3, 2026
…platforms

Ensures namespaces like "sites/123" (without trailing slash) produce
the same URLs as "sites/123/" so callers don't need to worry about
the convention. Adds tests on both platforms to verify.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jkmassel jkmassel force-pushed the jkmassel/namespace-trailing-slash branch from 02acb23 to 8955bfb Compare April 3, 2026 04:46
The mock HTTP client returns empty data, causing JSON decoding errors
that prevented the namespace URL assertions from being reached. Since
these tests only verify URL construction, try? is appropriate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

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

Looks good aside from the noted test failures.

Comment on lines +271 to +273
_ = try await repository.fetchPost(id: 1)
_ = try await repository.fetchEditorSettings()
_ = try await repository.fetchSettingsOptions()
Copy link
Copy Markdown
Member

@dcalhoun dcalhoun Apr 3, 2026

Choose a reason for hiding this comment

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

These invocations and others in the files caused JSON decoding errors due to the incomplete mock. This caused test and CI task failures. I'm pushed 0222eb3, but feel free to revert or change the approach as desired.

@dcalhoun dcalhoun merged commit aefcc11 into trunk Apr 3, 2026
18 checks passed
@dcalhoun dcalhoun deleted the jkmassel/namespace-trailing-slash branch April 3, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants