cli icon indicating copy to clipboard operation
cli copied to clipboard

Detect Content-Type of stdin via file util / "magic" heuristics

Open jbyler opened this issue 12 years ago • 2 comments

When setting the body of a request via piped input (stdin), it would be nice to still auto-detect the Content-Type, using pymagic or python-magic or similar.

jbyler avatar Oct 24 '13 17:10 jbyler

I'd love to see this feature in HTTPie but the problem is the additional dependencies.

In addition to introducing dependency on python-magic (which seems to be the better one), there are further dependencies that python-magic needs.

jkbrzt avatar Sep 10 '14 09:09 jkbrzt

Hi! Revisiting the issue after a while, some thoughts:

  • Needs more thinking as we currently auto-supply json/formencode
  • It is problematic with streaming as the mentioned libraries need some minimal amount of data to be able to decide
  • We are conservative about adding dependencies

The feature is something we'd love to have, but it needs a reliable cross-platform solution, ideally in Python. Also needs further thinking into how it would affect the rest of the HTTPie.

Almad avatar Feb 10 '21 14:02 Almad