Skip to content

feat: add standard client headers #685

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

Conversation

grdsdev
Copy link
Collaborator

@grdsdev grdsdev commented Mar 6, 2025

What kind of change does this PR introduce?

Bug fix, feature, docs update, ...

What is the current behavior?

Please link any relevant issues here.

What is the new behavior?

Feel free to include screenshots if it includes visual changes.

Additional context

Add any other context or screenshots.

Copy link

linear bot commented Mar 6, 2025

@grdsdev grdsdev marked this pull request as draft March 6, 2025 12:32
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13698748167

Details

  • 25 of 31 (80.65%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 74.835%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Sources/Helpers/Version.swift 0 6 0.0%
Totals Coverage Status
Change from base Build 13696472420: 0.004%
Covered Lines: 5100
Relevant Lines: 6815

💛 - Coveralls

@coveralls
Copy link

coveralls commented Mar 6, 2025

Pull Request Test Coverage Report for Build 14795739369

Details

  • 25 of 37 (67.57%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.5%) to 75.329%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Sources/Helpers/Version.swift 0 12 0.0%
Totals Coverage Status
Change from base Build 14792307257: 0.5%
Covered Lines: 5154
Relevant Lines: 6842

💛 - Coveralls

@grdsdev grdsdev force-pushed the guilherme/clibs-117-supabase-swift-send-standard-client-headers-on-all-requests branch 2 times, most recently from 9c3b783 to d41a530 Compare March 12, 2025 16:32
@grdsdev grdsdev force-pushed the guilherme/clibs-117-supabase-swift-send-standard-client-headers-on-all-requests branch from d41a530 to ceb9742 Compare May 2, 2025 09:15
@grdsdev grdsdev requested a review from Copilot May 2, 2025 09:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces standard client headers to the Supabase client and updates the related test assets. Key changes include:

  • Refactoring header initialization in SupabaseClient to use defaultHeaders.
  • Adding new client header values for platform and platform version.
  • Updating tests to assert the new header structure using inline snapshots.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/SupabaseTests/SupabaseClientTests.swift Updated tests to validate the new header values with snapshots.
Sources/Supabase/SupabaseClient.swift Refactored header setup to merge default and custom headers.
Sources/Supabase/Constants.swift Added a defaultHeaders closure generating standard headers.
Sources/Helpers/Version.swift Updated version and platform logic using new Swift patterns.
Package.swift Added InlineSnapshotTesting dependency for enhanced snapshot tests.
Comments suppressed due to low confidence (2)

Sources/Supabase/SupabaseClient.swift:163

  • [nitpick] Consider extracting the headers merging logic into a helper function to improve readability and ease future maintenance.
_headers = HTTPFields(defaultHeaders).merging(with: HTTPFields([...]))

Tests/SupabaseTests/SupabaseClientTests.swift:67

  • [nitpick] The inline snapshot contains hard-coded header values; be aware that any future changes to header generation logic may require updating this snapshot to avoid false negatives.
assertInlineSnapshot(of: client.headers, as: .customDump) {

@grdsdev grdsdev marked this pull request as ready for review May 2, 2025 13:04
@grdsdev grdsdev requested a review from dshukertjr May 2, 2025 13:04
@grdsdev grdsdev merged commit ad031c7 into main May 3, 2025
22 checks passed
@grdsdev grdsdev deleted the guilherme/clibs-117-supabase-swift-send-standard-client-headers-on-all-requests branch May 3, 2025 10:19
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.

3 participants