Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug?: content type is always application/json or text/plain #4272

Closed
derdeka opened this issue Dec 6, 2019 · 2 comments
Closed

bug?: content type is always application/json or text/plain #4272

derdeka opened this issue Dec 6, 2019 · 2 comments
Labels

Comments

@derdeka
Copy link
Contributor

derdeka commented Dec 6, 2019

Steps to reproduce

I did some experiments of uml diagram generation with nomnoml as an lb4 extension. The output of an @get endpoint is an svg image.

AFAIK there is not way to set an content-type as strong-remoting is always setting text/plain !?:

https://github.com/strongloop/strong-remoting/blob/33fbd72fb46035f707c3c62dce6b36ab075fb61e/lib/http-context.js#L494-L498

Current Behavior

Content-Type is always application/json or text/plain.

Expected Behavior

Need Content-Type image/svg+xml for my use case.

Link to reproduction sandbox

https://github.com/derdeka/loopback4-extensions/blob/9d2ac1d877e2f8955a6bbcd9c9af3ec485f62d2e/packages/nomnoml/src/controllers/uml.controller.ts#L22

npm install @derdeka/loopback4-extension-nomnoml --save

in your application.ts:

import { ModelMetadataService, UmlBindings, UmlComponent, UmlConfig } from '@derdeka/loopback4-extension-nomnoml';
import * as AllModels from './models';
this.configure<UmlConfig>(UmlBindings.COMPONENT).to({
  umlPath: '/uml',
});
this.component(UmlComponent);
const service = this.getSync<ModelMetadataService>(UmlBindings.METADATA_SERVICE);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Object.values(AllModels).forEach((model: any) => service.inspect(model));

Additional Information

Maybe related to #2752 and #436

@derdeka derdeka added the bug label Dec 6, 2019
@dhmlau
Copy link
Member

dhmlau commented Dec 10, 2019

Discussed with @bajtos, he mentioned #2230 covers the requirement of this issue. I've added more information based on our conversation: #2230 (comment).

@derdeka, please try out the workaround and continue any discussion over #2230. I'd like to close this issue as duplicate. Thanks!

@dhmlau dhmlau closed this as completed Dec 10, 2019
@derdeka
Copy link
Contributor Author

derdeka commented Dec 10, 2019

@dhmlau Thanks for the hint. I've tested the workaround successfully - works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants