-
Notifications
You must be signed in to change notification settings - Fork 9
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
Remove exchangeId from submit endpoint paths #182
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -77,7 +77,7 @@ describe('client', () => { | |||||
expect(e.statusCode).to.exist | ||||||
expect(e.details).to.exist | ||||||
expect(e.recipientDid).to.equal(pfiDid.uri) | ||||||
expect(e.url).to.equal(`https://localhost:9000/exchanges/${rfq.metadata.exchangeId}/rfq`) | ||||||
expect(e.url).to.equal(`https://localhost:9000/exchanges/rfq`) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for creating an exchange, this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
}) | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -140,22 +140,22 @@ | |||||
listen(port: number | string, callback?: () => void) { | ||||||
const { offeringsApi, exchangesApi, pfiDid } = this | ||||||
|
||||||
this.api.post('/exchanges/:exchangeId/rfq', (req: Request, res: Response) => | ||||||
this.api.post('/exchanges/rfq', (req: Request, res: Response) => | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
createExchange(req, res, { | ||||||
callback: this.callbacks['rfq'], | ||||||
offeringsApi, | ||||||
exchangesApi, | ||||||
}) | ||||||
Check failure Code scanning / CodeQL Missing rate limiting High
This route handler performs
authorization Error loading related location Loading |
||||||
) | ||||||
|
||||||
this.api.post('/exchanges/:exchangeId/order', (req: Request, res: Response) => | ||||||
this.api.post('/exchanges/order', (req: Request, res: Response) => | ||||||
submitOrder(req, res, { | ||||||
callback: this.callbacks['order'], | ||||||
exchangesApi | ||||||
}) | ||||||
) | ||||||
|
||||||
this.api.post('/exchanges/:exchangeId/close', (req: Request, res: Response) => | ||||||
this.api.post('/exchanges/close', (req: Request, res: Response) => | ||||||
submitClose(req, res,{ | ||||||
callback: this.callbacks.close, | ||||||
exchangesApi, | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,7 +23,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
}) | ||||||
|
||||||
it('returns a 400 if no request body is provided', async () => { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method: 'POST' | ||||||
}) | ||||||
|
||||||
|
@@ -38,7 +38,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
}) | ||||||
|
||||||
it('returns a 400 if request body is not a valid json object', async () => { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : '!@!#' | ||||||
}) | ||||||
|
@@ -59,7 +59,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
const rfq = await DevTools.createRfq({ sender: aliceDid, receiver: pfiDid }) | ||||||
await rfq.sign(aliceDid) | ||||||
|
||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : JSON.stringify({ rfq: rfq, replyTo: 'foo' }) | ||||||
}) | ||||||
|
@@ -81,7 +81,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
const order = await DevTools.createOrder({ sender: aliceDid, receiver: pfiDid }) | ||||||
await order.sign(aliceDid) | ||||||
|
||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : JSON.stringify({ rfq: order }) | ||||||
}) | ||||||
|
@@ -103,7 +103,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
const rfq = await DevTools.createRfq({ sender: aliceDid, receiver: pfiDid }) | ||||||
// deliberately omit rfq.sign(aliceDid) | ||||||
|
||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : JSON.stringify({ rfq }) | ||||||
}) | ||||||
|
@@ -127,7 +127,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
|
||||||
(api.exchangesApi as InMemoryExchangesApi).addMessage(rfq) | ||||||
|
||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : JSON.stringify({ rfq }) | ||||||
}) | ||||||
|
@@ -160,7 +160,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
}) | ||||||
await rfq.sign(aliceDid) | ||||||
|
||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : JSON.stringify({ rfq }) | ||||||
}) | ||||||
|
@@ -198,7 +198,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
}) | ||||||
await rfq.sign(aliceDid) | ||||||
|
||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : JSON.stringify({ rfq }) | ||||||
}) | ||||||
|
@@ -303,7 +303,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
}) | ||||||
|
||||||
it('returns a 202 if RFQ is accepted', async () => { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : JSON.stringify({ rfq }) | ||||||
}) | ||||||
|
@@ -318,7 +318,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
}) | ||||||
api.onSubmitRfq(callbackSpy) | ||||||
|
||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : JSON.stringify({ rfq }) | ||||||
}) | ||||||
|
@@ -343,7 +343,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => { | |||||
|
||||||
const replyTo = 'https://tbdex.io/example' | ||||||
|
||||||
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', { | ||||||
const resp = await fetch('http://localhost:8000/exchanges/rfq', { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
method : 'POST', | ||||||
body : JSON.stringify({ rfq, replyTo }) | ||||||
}) | ||||||
|
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.
only add
${kind}
if not RFQ