Giter VIP home page Giter VIP logo

Comments (5)

Garfield550 avatar Garfield550 commented on May 31, 2024 1

@devinivy Thanks, maybe should note this in the readme.

I saw works great on its own or with other frameworks from the readme, no specific implementation specifications are mentioned, so I use this to parse attachment.

content is part of the hapi ecosystem and was designed to work seamlessly with the hapi web framework and its other components (but works great on its own or with other frameworks).

from content.

Garfield550 avatar Garfield550 commented on May 31, 2024

internals.contentDispositionRegex = /^\s*form-data\s*(?:;\s*(.+))?$/i;

Not support attachment

image

GitHub Octokit return attachment; filename=name-repo-a849a73.zip, but @hapi/content can not parse it.

from content.

devinivy avatar devinivy commented on May 31, 2024

I realize it's not readily apparent, but disposition() is designed specifically to parse multipart form data payloads, which requires the disposition type be form-data. In the spec referenced above it notes:

Note: This document does not apply to Content-Disposition header
fields appearing in payload bodies transmitted over HTTP, such as
when using the media type "multipart/form-data" ([RFC2388]).

Here is where we use Content.disposition()— it's in pez, hapi's multipart parser: https://github.com/hapijs/pez/blob/0cf5f3031a453e7db91610c070206342e89964b0/lib/index.js#L292

If we decide to parse out the disposition type and allow other types, we would have to treat this like a breaking change and ensure pez only allows form-data.

from content.

devinivy avatar devinivy commented on May 31, 2024

I can see how that could easily happen. Do you think if we changed its subtitle from "HTTP Content-* headers parsing" to "HTTP Content-* request headers parsing" that it would have signaled this better? If so, I would give a PR for that change a ✅.

from content.

Garfield550 avatar Garfield550 commented on May 31, 2024

I can see how that could easily happen. Do you think if we changed its subtitle from "HTTP Content-* headers parsing" to "HTTP Content-* request headers parsing" that it would have signaled this better? If so, I would give a PR for that change a ✅.

Yes, I think so.

Cause this package is not a full functional http Content- parser.

from content.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.