-
-
Notifications
You must be signed in to change notification settings - Fork 43
implement http content-negotiation for plotly-graph #228
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
Conversation
test/integration/orca_serve_test.js
Outdated
}) | ||
}) | ||
|
||
t.test('it should override format provided in payload', t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this one... 🤔
Problematic case: the user asks for SVG in HTTP header but also ask for PNG in the payload via format
attribute. Which one should win?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have it the right way here: header overriding payload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/app/server/create-server.js
Outdated
@@ -157,7 +157,7 @@ function createServer (app, BrowserWindow, ipcMain, opts) { | |||
} | |||
|
|||
pending++ | |||
comp._module.parse(body, compOpts, sendToRenderer) | |||
comp._module.parse(body, compOpts, sendToRenderer, req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I would prefer leaving sendToRenderer
as the last argument, as callbacks sendToRenderer
are usually passed last.
I think having
comp._module.parse(body, req, compOpts, sendToRenderer)
would be best ... and don't forget to update:
https://github.com/plotly/orca/blob/master/CONTRIBUTING.md#nomenclature-for-ipc-callbacks
accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in c1e0ab5
@@ -2,7 +2,7 @@ | |||
|
|||
const path = require('path') | |||
const { spawn } = require('child_process') | |||
const electronPath = require('electron') | |||
const electronPath = process.env['ELECTRON_PATH'] ? process.env['ELECTRON_PATH'] : require('electron') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not mandatory for this PR but it provides a way to use a manually installed electron
in the event that electron-download fails to install pre-built binary for your platform.
I could remove it but it's a must-have in my current dev environment and maybe it is also the case for others. It simply gives more flexibility. What do you think?
@@ -184,6 +184,34 @@ tap.test('createServer:', t => { | |||
}) | |||
}) | |||
|
|||
t.test('it should do HTTP content-negotation for *plotly-graph* component', t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened to your other content-negotiation tests? Don't you want to test a valid content negotiation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done 💃 |
Closes #226
Check added tests for details!
accept: */*
andaccept: *