Comments (5)
so with minimal requirements it would look like this:
{
"content": {
"mimeType": "text/plain",
"text": "Hello"
}
}
status
, andstatusText
, will default to200
&OK
.Content-Type
header will default tomimeType
creating new Bins would end up looking like this with the minimal setup:
curl mockbin.org/bin/create -H "application/json" -d '{"success": true, "payload": ["array of stuff"]}'
thoughts?
from insomnia-mockbin.
Well our API responses typically look like:
{
success: true,
payload: ['array of stuff']
}
So we're hoping to have a way to directly return a body like that, with payload in the root and containing JSON. The additional HAR headers aren't the problem so much as that my body ends up nested inside 'content' as text even if I say the content type is application/json
So I was hoping there was maybe a way to either select HAR
and get this format or maybe a raw
where i can indicate the content type and dump a stringified JSON body
If there's some way we can help with the feature, we're not afraid to roll our sleeves up
from insomnia-mockbin.
oh ... methinks we are talking about two different things and perhaps you are using this wrong ...
after creating a bin, accessing it will give you the response body directly:
curl mockbin.org/bin/create -H "Content-Type: application/json" --data '{"status": 200,"statusText": "OK","httpVersion": "HTTP/1.1","headers": [{"name": "content-type","value": "application/json"}],"cookies": [],"content": {"mimeType": "application/json","text": "{\"success\": true, \"payload\": [\"array of stuff\"]}","size": 0},"redirectURL": "","bodySize": 0,"headersSize": 0}'
(^ this was the part I'm referencing, the "creation", I can simply by removing some of the requirements and assuming 200 OK
and Content-Type
to match mimeType
)
curl -v http://mockbin.com/bin/8fbdd762-3c3e-4429-8ab1-2338b594b705
result
GET /bin/8fbdd762-3c3e-4429-8ab1-2338b594b705 HTTP/1.1
User-Agent: curl/7.35.0
Host: mockbin.com
Accept: */*
HTTP/1.1 200 OK
Date: Mon, 13 Apr 2015 21:00:30 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 48
Connection: keep-alive
Vary: Accept-Encoding
{"success": true, "payload": ["array of stuff"]}
how are you calling the Bin that results in you getting the HAR dump?
from insomnia-mockbin.
I was definitely using it wrong! Okay I see it working as expected now. I was confused by the /bin/xxx/view
page and thought it was my final output.
Thanks!
from insomnia-mockbin.
from insomnia-mockbin.
Related Issues (20)
- Docker - ReferenceError: Promise is not defined HOT 4
- mockbin.org is no longer creating bins because of redis memory HOT 10
- Infinite loading on bin creation HOT 1
- POST to /echo getting CORS warning
- Certificate of mockbin.org is sometimes incorrect HOT 2
- The mockbin.com certificate expired on December 16th. HOT 3
- Deploy mockbin in kubernetes HOT 1
- Headers are swallowed when using the bins HOT 2
- problem adding new API
- Does not start at all HOT 4
- Can't create bin HOT 1
- When the last header row is blank, it should not add new header rows
- Bins not working anymore HOT 2
- issues with redirect
- Automatic CORS handling problem HOT 2
- API example is in too narrow of a DIV
- Can I request to have a bin deleted after testing? HOT 1
- Decompression failed when trying to use a har that was generated using 'disable cache'. HOT 1
- when running locally and via docker compose I am getting following error: "ReferenceError: client is not defined"
- Mockbin.com/har has stopped working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from insomnia-mockbin.