Skip to content
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

Allow send(_ binary:) to accept some DataProtocol #146

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

fizker
Copy link
Contributor

@fizker fizker commented Jan 4, 2024

These changes are now available in 2.15.0

This allows for passing in Data or ByteBufferView to send(_:), as well as the currently-supported [UInt8] type.

@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.85%. Comparing base (a935b63) to head (8d2d799).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #146   +/-   ##
=======================================
  Coverage   82.85%   82.85%           
=======================================
  Files           6        6           
  Lines         659      659           
=======================================
  Hits          546      546           
  Misses        113      113           
Files Coverage Δ
Sources/WebSocketKit/WebSocket.swift 89.04% <100.00%> (ø)

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@fizker
Copy link
Contributor Author

fizker commented Jan 4, 2024

Regarding the failing test, it reacts to the change of type. But since [UInt8] conforms to DataProtocol (which for the record is protocol DataProtocol : RandomAccessCollection where Self.Element == UInt8, Self.SubSequence : DataProtocol), I am not sure it actually is a breaking change?

Copy link
Contributor

@MahdiBM MahdiBM left a comment

Choose a reason for hiding this comment

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

This could be a breaking change to some source codes, but i don't think it realistically is.

@0xTim 0xTim added the semver-minor Contains new APIs label Mar 20, 2024
Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

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

Thanks for this, I think we're fine here

@0xTim 0xTim changed the title Changed type of send(_ binary:) from [UInt8] to some DataProtocol Allow send(_ binary:) to accept some DataProtocol Mar 20, 2024
@0xTim 0xTim merged commit 4232d34 into vapor:main Mar 20, 2024
12 of 13 checks passed
@fizker fizker deleted the accept-dataprotocol-for-send-binary branch March 23, 2024 09:49
@gregcotten
Copy link

Why wasn't this changed in the Concurrency shims as well?

public func send(_ binary: [UInt8]) async throws {

@0xTim
Copy link
Member

0xTim commented Mar 30, 2024

Probably just an oversight tbh

@fizker
Copy link
Contributor Author

fizker commented Apr 1, 2024

Why wasn't this changed in the Concurrency shims as well?

public func send(_ binary: [UInt8]) async throws {

I didn't know that overload existed until you told me about it. I stumbled on the one I changed and didn't look further as it did what I wanted 🤷.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor Contains new APIs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants