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

feat(upload): added ssl cert options to upload and download function #2165

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

HuakunShen
Copy link

@HuakunShen HuakunShen commented Dec 9, 2024

Original Issue: #2092

Add skip_ssl_cert_check and trust_ssl_cert options to upload and download function, to skip ssl check or trust a given self signed ssl cert.

Sample Code:

 download(
      "https://localhost:9559/stream-file",
      "/Users/hk/Downloads/test.mp4",
      (progress) => {
        console.log(progress);
      },
      undefined,
      undefined,
      {
        skipSslCertCheck: true,
      }
    ))

My app (https://github.com/kunkunsh/kunkun) includes a local file transfer server. Self-signed cert is used for data encryption, but this plugin doesn't support self-signed cert or skipping SSL check.

Function signatures:

async function download(
  url: string,
  filePath: string,
  progressHandler?: ProgressHandler,
  headers?: Map<string, string>,
  body?: string,
  options?: {
    skipSslCertCheck?: boolean
    trustSslCert?: string
  }
): Promise<void>


async function upload(
  url: string,
  filePath: string,
  progressHandler?: ProgressHandler,
  headers?: Map<string, string>,
  options?: {
    skipSslCertCheck?: boolean
    trustSslCert?: string
  }
): Promise<string> 

@HuakunShen HuakunShen requested a review from a team as a code owner December 9, 2024 07:54
@HuakunShen
Copy link
Author

HuakunShen commented Dec 9, 2024

Another suggestion: an options object field is added to the JS API download() and upload(), which prevents having to use undefined for not used variables. headers and body field should also be added to the options object.
But to keep backward compatibility, I didn't move them in the PR to avoid breaking the API.

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Package Changes Through 525f458

There are 2 changes which include log with patch, log-js with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.6 2.0.7
api-example-js 2.0.3 2.0.4
log 2.0.3 2.0.4
log-js 2.0.1 2.0.2

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

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.

1 participant