Comments (4)
Why are you trying to json encode the Response
object? There's probably a better way to do what you're trying to accomplish.
from httpful.
When an error occurs, I want to send an email with the entire response for alert + debugging purposes. JSON is a pretty format, so I thought of using it.
from httpful.
You definitely wouldn't want to json encode the whole PHP object then. I assume you mean the HTTP error? You can use $response->hasErrors()
to check if there was an unsuccessful HTTP response and then the actual error itself would be in the body of the response. Might help if you post more context in a gist or something. This isn't a bug in Httpful though.
from httpful.
Looking back at this, the title and body of your issue imply two different things. If you are interesting in catching an exception and then JSON encoding it. I would recommend something like
json_encode(array(
'error' => $e->getMessage()
));
Again more context and clarification here would be helpful.
from httpful.
Related Issues (20)
- Composer autoload doesn't work HOT 2
- Test needs to be updated HOT 1
- Your website's domain has expired HOT 2
- Fortify Header Manipulation Vulnerability
- Body parsing broken in 0.3.0 HOT 2
- Timeouts HOT 1
- Curl proxy configuration is not used by Httpful HOT 1
- Got wrong json response HOT 1
- Download whole html web page including Css and js and images?
- Corrupted Response when JSON value is a XML
- Error 500 using PHP 7.3.29 (ok on 7.2.2) and largish payload
- curl required despite it not being mentioned in requirements and presented as an "alternative to curl"
- Oauth headers with post() HOT 1
- Warnings in PHP 8.1 HOT 5
- Trying to get in touch regarding a security issue HOT 2
- calling expectsJson() before body() of a post request breaks response parsing
- Documentation ????? HOT 2
- not work in php 5.3.1 HOT 1
- Support for PHP8+ HOT 4
- Templating broken by errant unset statement 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 httpful.