Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Ability to define a custom default user-agent in config.json

Đang mở
#1,568 2 bình luận 4 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
52/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu bằng cách truy vết cách ~/.config/httpie/config.json và default_options của nó được đọc, sau đó theo dõi cách các tùy chọn đó được sắp xếp so với URL và các header trên dòng lệnh. Thay đổi được hoàn tất khi user-agent tùy chỉnh hoặc header mặc định đã cấu hình được áp dụng cho các request mà không cần lặp lại nó trên dòng lệnh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement new

Checklist

  • I've searched for similar feature requests.

Enhancement request

I propose a way to set a custom user-agent as a value to default_options in ~/.config/httpie/config.json. Or, perhaps adding a new config section named default_headers would be more logical.


Problem it solves

Including a custom user-agent on the command line adds about 130 characters to the input, which is a bit cumbersome if every httpie command requires one. It's a lot of extra text that doesn't change often that makes it hard to navigate the prompt fills up my history with super-long commands. Yuck.


Additional information

I actually tried to do this:

    "default_options": [
        "User-Agent:'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Safari/605.1.15'"
    ]

…but it doesn't work because it seems the values in default_options are applied before the URL on the command line, and the user-agent (because it's a header) must be specified after the URL. Because of this, adding a default_headers config section might be easier to implement.

Ngôn ngữ chính
Python
Star
38.6k
Fork
4k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của httpie/cli

Tất cả issue của httpie/cli

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.