node-libcurl v2.3.0 Release Notes
Release Date: 2020-11-15 // over 3 years ago-
๐ Probably the last release that
curly
is considered experimental.๐ฅ Breaking Change
๐
curly
(andcurly.<method>
) is now able to automatically parse the response body based on the content-type header of the response. #240
0๏ธโฃ Default parsers forapplication/json
(callsJSON.parse
) andtext/*
(converts the rawBuffer
to a string withutf8
encoding) were added. This means that for responses without a matching content-type the rawBuffer
will be returned. This is different from the previous behavior where a string would always be returned.
0๏ธโฃ The default parsers can be overwritten by settingcurly.defaultResponseBodyParsers
to an object with the format:{ 'content-type': (data: Buffer, headers: HeaderInfo[]) => any }
Where
content-type
can be one of these:- the exact content-type.
- a pattern using
*
to match specific parts of the content-type, liketext/*
. - a catch-all pattern: just
*
.
๐ You can also override the parsers using the following options:
curlyResponseBodyParsers
object that will be merged withdefaultResponseBodyParsers
.curlyResponseBodyParser
a parser that will be used for all responses.
๐ It's also possible to set
curlyResponseBodyParser
tofalse
and the data returned will always be the rawBuffer
.0๏ธโฃ Of course, it is still possible to use your own
writeFunction
(libcurlCURLOPT_WRITEFUNCTION
option) to set your own write callback and not rely on this default handling of the response.๐ As
curly
is marked as experimental, this allows us to do a breaking change in a minor version bump. This release should make the curly API more stable and provide a better developer experience, however, the API remains experimental.๐ Fixed
- Some
curly.<method>
calls not working correctly, to be more specific, all calls that were notget
,post
andhead
. - Errors thrown by the internal
Curl
instance used bycurly
not being re-thrown correctly. - 0๏ธโฃ Progress callbacks were not allowing to use default libcurl progress meter (by returning
CurlProgressFunc.Continue
).
โ Added
- 0๏ธโฃ Calling
curly.create(options)
will now return a newcurly
object that will use the passedoptions
as defaults. #247 - 0๏ธโฃ TypeScript:
curly
(andcurly.<method>
) now accepts a generic type parameter which will be the type of thedata
returned. By default, this is set toany
. - โ Added new options to the
curly
API:curlyBaseUrl: string
, if set, their value will always be added as the prefix for the URL.curlyLowerCaseHeaders: boolean
, if set to true, headers will be returned in lower case. Defaults to false. #240
- โ Added new methods and
CurlFeature
allowing the use of streams to upload and download data without having to setWRITEFUNCTION
and/orREADFUNCTION
manually. #237Curl.setUploadStream
Curl.setStreamProgress
Curl.setStreamResponseHighWaterMark
CurlFeature.StreamResponse
๐ New options were also added to thecurly
API:curlyProgressCallback
curlyStreamResponse
curlyStreamResponseHighWaterMark
curlyStreamUpload
These new features related to streams are only reliable when using a libcurl version >= 7.69.1.
- ๐ Support libcurl info
CURLINFO_CERTINFO
. Can be retrieved usinggetInfo("CERTINFO")
. Thanks to @Sergey-Mityukov for most of the work on this. - Support libcurl info
CURLINFO_EFFECTIVE_METHOD
. Requires libcurl >= 7.72.0. - Support libcurl info
CURLINFO_PROXY_ERROR
. UseCurlPx
for constants. Requires libcurl >= 7.73.0. - Support libcurl option
CURLOPT_SSL_EC_CURVES
. Requires libcurl >= 7.73.0. - โ Added prebuilt binaries for Electron v10.1
- The libcurl version being used by prebuilt binaries is now 7.73.0 and it's not built with c-ares.
๐ Changed
curly
now has 100% code coverage.
โ Removed
- โ Removed prebuilt binaries for: Electron v3, Electron v4, Nwjs v0.42, and Nwjs v0.43