Skip to content

Serving other MIME types #3

@sigilante

Description

@sigilante

I modified /lib/schooner.hoon to serve other types for a tutorial.

E.g.

+$  resource
  $%  
    [%manx m=manx]            [%json j=json]
    [%html h=cord]            [%login-redirect l=cord]
    [%redirect o=cord]        [%plain p=tape]
    [%none ~]                 [%stock ~]
    [%image-png p=@]          [%audio-wav p=@]
  ==

and

    ::
      %image-png
    :_  `(as-octs:mimes:html p.resource)
    :-  http-status
    (weld headers ['content-type'^'image/png']~)
    ::
      %audio-wav
    :_  `(as-octs:mimes:html p.resource)
    :-  http-status
    (weld headers ['content-type'^'audio/wav']~)

Honestly it would probably be nicer to build these automatically as a gate rather than hardcode n of them. What do you think?

Alternatively I can just PR the changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions