Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Apr 28, 2022
1 parent 1edcc34 commit f64d0f5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
8 changes: 6 additions & 2 deletions packages/solo/src/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function makeHTTPListener(
},
}),
);
app.use(express.json()); // parse application/json
app.use(express.json({ limit: 512 * 1024 * 1024 })); // parse application/json
const server = http.createServer(app);

// serve the static HTML for the UI
Expand Down Expand Up @@ -218,7 +218,11 @@ export async function makeHTTPListener(
return;
}

const expectedLengthHeader = req.getHeader('Content-Length');
const expectedLengthHeader = req.headers['content-length'];
if (expectedLengthHeader === undefined) {
res.json({ ok: false, rej: 'Content-Length header required' });
return;
}
const expectedLength = parseInt(expectedLengthHeader, 10);

if (expectedLength > maximumBundleSize) {
Expand Down
29 changes: 17 additions & 12 deletions packages/solo/test/test-home.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import test from 'ava';
import http from 'http';

import bundleSource from '@endo/bundle-source';
import { makeBundlePublisher } from '@agoric/publish-bundle';
import { makeJsonHttpClient } from '@agoric/publish-bundle/node-powers.js';
// TODO
// import { makeBundlePublisher } from '@agoric/publish-bundle';
// import { makeJsonHttpClient } from '@agoric/publish-bundle/node-powers.js';
import { AmountMath } from '@agoric/ertp';
import { Far } from '@endo/marshal';
import { resolve as importMetaResolve } from 'import-meta-resolve';
Expand Down Expand Up @@ -81,16 +82,20 @@ test.serial('home.wallet - receive zoe invite', async t => {
const contractRoot = new URL(contractUrl).pathname;
t.log({ contractRoot });
const bundle = await bundleSource(contractRoot);
const publishBundle = makeBundlePublisher({
getAccessToken() {return ''},
jsonHttpCall: makeJsonHttpClient({ http }),
});
const hashBundle = await publishBundle(bundle, {
type: 'http',
port: SOLO_PORT,
host: '127.0.0.1',
});
const installationHandle = await E(zoe).install(hashBundle);
// TODO(kris) the following will be necessary when zoe.install no longer
// accepts source bundles, but currently does not work on account of HTTP
// message size limits I've not figured out how to edit.
// const publishBundle = makeBundlePublisher({
// getAccessToken() {return ''},
// jsonHttpCall: makeJsonHttpClient({ http }),
// });
// const hashBundle = await publishBundle(bundle, {
// type: 'http',
// port: SOLO_PORT,
// host: '127.0.0.1',
// });
// const installationHandle = await E(zoe).install(hashBundle);
const installationHandle = await E(zoe).install(bundle);
const { creatorInvitation: invite } = await E(zoe).startInstance(
installationHandle,
);
Expand Down

0 comments on commit f64d0f5

Please sign in to comment.