Skip to content

[Feature Request]: Allow specifying user-agent header on NSURLSession Config #1411

Closed
@breenbob

Description

@breenbob

Summary

As per this link the NSURLSession automatically includes a default user agent in this format:
$(CFBundleName)/$(CFBundleVersion) CFNetwork/808.3 Darwin/17.2.0

I believe this is cause of an issue currently blocking me from using Shiny.Net.Http in my iOS app, where all requests to download files from our AWS CDN fail with a 403 error. The URL passed in to the download task is correct, works in the browser and on Android.

According to that same link, next answer further down on the page, the NSURLSessionConfiguration allows you to specify user agent header like so:
config.httpAdditionalHeaders = ["User-Agent": "myapp User-Agent"]

API Changes

Add a new nullable string property to AppleConfiguration for CustomUserAgent.
Check if null or empty where AppleConfig values are mapped to NSURLConfiguration and set custom user agent string.

Intended Use Case

For scenario where backend server requires specific user agents to be used.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or requestunverifiedThis issue has not been verified by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions