mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-03 00:02:48 -04:00
Add EditorConfig file
Resolve issues. More info here: https://editorconfig.org/
This commit is contained in:
parent
c26df87b86
commit
680b9f8a6c
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
@ -57,4 +57,3 @@ conn = Faraday.new(...) do |f|
|
||||
f.adapter AnyAdapter
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -16,4 +16,4 @@ $ bundle exec jekyll serve
|
||||
# The site will now be reachable at http://127.0.0.1:4000/faraday/
|
||||
```
|
||||
|
||||
[website]: https://lostisland.github.io/faraday
|
||||
[website]: https://lostisland.github.io/faraday
|
||||
|
@ -15,4 +15,4 @@
|
||||
<a href="{{ page.next_link }}">{{ page.next_name }} <i class="fa fa-angle-right"></i></a>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -18,4 +18,4 @@ for customization (DocSearch feature) -->
|
||||
inputSelector: '#search-box',
|
||||
debug: false // Set debug to true if you want to inspect the dropdown
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
@ -1,50 +1,50 @@
|
||||
<!-- This is extracted directly from https://github.com/rohanchandra/type-theme/blob/c6ec5a69ff7dfe2df193be08515193c72bd4a55d/_includes/header.html
|
||||
for customization (DocSearch feature) -->
|
||||
<header class="site-header">
|
||||
<div class="branding">
|
||||
{% if site.theme_settings.gravatar %}
|
||||
<a href="{{ site.baseurl }}/">
|
||||
<img class="avatar" src="https://secure.gravatar.com/avatar/{{ site.theme_settings.gravatar }}?s=100" alt=""/>
|
||||
</a>
|
||||
{% elsif site.theme_settings.avatar %}
|
||||
<a href="{{ site.baseurl }}/">
|
||||
<img class="avatar" src="{{ site.baseurl }}/{{ site.theme_settings.avatar }}" alt=""/>
|
||||
</a>
|
||||
{% endif %}
|
||||
<h1 class="site-title">
|
||||
<a href="{{ site.baseurl }}/">{{ site.theme_settings.title }}</a>
|
||||
</h1>
|
||||
</div>
|
||||
<nav class="site-nav">
|
||||
<ul>
|
||||
{% if site.theme_settings.site_navigation_sort %}
|
||||
{% assign site_pages = site.pages | sort: site.theme_settings.site_navigation_sort %}
|
||||
{% else %}
|
||||
{% assign site_pages = site.pages %}
|
||||
{% endif %}
|
||||
{% for page in site_pages %}
|
||||
{% if page.title and page.hide != true %}
|
||||
<li>
|
||||
<a class="page-link" href="{{ page.url | relative_url }}">
|
||||
{{ page.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<!-- Social icons from Font Awesome, if enabled -->
|
||||
{% include icons.html %}
|
||||
<div class="branding">
|
||||
{% if site.theme_settings.gravatar %}
|
||||
<a href="{{ site.baseurl }}/">
|
||||
<img class="avatar" src="https://secure.gravatar.com/avatar/{{ site.theme_settings.gravatar }}?s=100" alt=""/>
|
||||
</a>
|
||||
{% elsif site.theme_settings.avatar %}
|
||||
<a href="{{ site.baseurl }}/">
|
||||
<img class="avatar" src="{{ site.baseurl }}/{{ site.theme_settings.avatar }}" alt=""/>
|
||||
</a>
|
||||
{% endif %}
|
||||
<h1 class="site-title">
|
||||
<a href="{{ site.baseurl }}/">{{ site.theme_settings.title }}</a>
|
||||
</h1>
|
||||
</div>
|
||||
<nav class="site-nav">
|
||||
<ul>
|
||||
{% if site.theme_settings.site_navigation_sort %}
|
||||
{% assign site_pages = site.pages | sort: site.theme_settings.site_navigation_sort %}
|
||||
{% else %}
|
||||
{% assign site_pages = site.pages %}
|
||||
{% endif %}
|
||||
{% for page in site_pages %}
|
||||
{% if page.title and page.hide != true %}
|
||||
<li>
|
||||
<a class="page-link" href="{{ page.url | relative_url }}">
|
||||
{{ page.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<!-- Social icons from Font Awesome, if enabled -->
|
||||
{% include icons.html %}
|
||||
|
||||
<!-- Search bar -->
|
||||
{% if site.theme_settings.search %}
|
||||
<li>
|
||||
<form action="{{ site.baseurl }}/search.html" method="get">
|
||||
<input type="text" id="search-box" name="query" placeholder="Search" class="">
|
||||
<button type="submit" class="">
|
||||
<i class="fa fa-fw fa-search"></i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
<!-- Search bar -->
|
||||
{% if site.theme_settings.search %}
|
||||
<li>
|
||||
<form action="{{ site.baseurl }}/search.html" method="get">
|
||||
<input type="text" id="search-box" name="query" placeholder="Search" class="">
|
||||
<button type="submit" class="">
|
||||
<i class="fa fa-fw fa-search"></i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<form id="search-form">
|
||||
<input type="text" id="search-box" placeholder="Search">
|
||||
@ -53,7 +53,7 @@ for customization (DocSearch feature) -->
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
</header>
|
||||
|
@ -6,4 +6,4 @@ $link-color: #EE4266;
|
||||
$text-color: #3C3C3C;
|
||||
$font-family-main: 'KohinoorTelugu-Regular', Helvetica, Arial, sans-serif;
|
||||
$font-family-headings: 'Raleway', Helvetica, Arial, sans-serif;
|
||||
$search-color: #EE4266;
|
||||
$search-color: #EE4266;
|
||||
|
@ -127,4 +127,3 @@ footer
|
||||
// when needing search usually
|
||||
@media screen and (max-width: 800px)
|
||||
display: none
|
||||
|
||||
|
@ -4,4 +4,4 @@
|
||||
@import "variables";
|
||||
@import "type-theme";
|
||||
@import "faraday";
|
||||
@import "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css"
|
||||
@import "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css"
|
||||
|
@ -46,4 +46,4 @@ fetch('https://api.github.com/repos/lostisland/faraday/stats/contributors')
|
||||
hideLoader();
|
||||
showTeam();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ Faraday ships with some useful middleware that you can use to customize your req
|
||||
Middleware are separated into two macro-categories: **Request Middleware** and **Response Middleware**.
|
||||
The former usually deal with the request, encoding the parameters or setting headers.
|
||||
The latter instead activate after the request is completed and a response has been received, like
|
||||
parsing the response body, logging useful info or checking the response status.
|
||||
parsing the response body, logging useful info or checking the response status.
|
||||
|
||||
### Request Middleware
|
||||
|
||||
|
@ -27,4 +27,4 @@ end
|
||||
Faraday.new(...) do |conn|
|
||||
conn.token_auth('authentication-token')
|
||||
end
|
||||
```
|
||||
```
|
||||
|
@ -25,7 +25,7 @@ can be specified with a String path to a local file, or an IO object.
|
||||
* `Faraday::ParamPart` wraps a String value with a Content-Type, and optionally
|
||||
a Content-ID.
|
||||
|
||||
Note: `Faraday::ParamPart` was added in Faraday v0.16.0. Before that,
|
||||
Note: `Faraday::ParamPart` was added in Faraday v0.16.0. Before that,
|
||||
`Faraday::FilePart` was called `Faraday::UploadIO`.
|
||||
|
||||
### Example Usage
|
||||
@ -47,13 +47,13 @@ payload = { string: 'value' }
|
||||
payload[:file] = Faraday::FilePart.new(__FILE__, 'text/x-ruby')
|
||||
|
||||
# specify filename because IO object doesn't know it
|
||||
payload[:file_with_name] = Faraday::FilePart.new(File.open(__FILE__),
|
||||
'text/x-ruby',
|
||||
payload[:file_with_name] = Faraday::FilePart.new(File.open(__FILE__),
|
||||
'text/x-ruby',
|
||||
File.basename(__FILE__))
|
||||
|
||||
# Sets a custom Content-Disposition:
|
||||
# nil filename still defaults to File.basename(__FILE__)
|
||||
payload[:file_with_header] = Faraday::FilePart.new(__FILE__,
|
||||
payload[:file_with_header] = Faraday::FilePart.new(__FILE__,
|
||||
'text/x-ruby', nil,
|
||||
'Content-Disposition' => 'form-data; foo=1')
|
||||
|
||||
|
@ -120,7 +120,7 @@ response_statuses = []
|
||||
retry_options = {
|
||||
retry_block: -> (env, options, retries, exc) { response_statuses << env.status }
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
[raise_error]: ../middleware/raise-error
|
||||
|
@ -86,7 +86,7 @@ end
|
||||
|
||||
You can also provide a custom formatter to control how requests and responses are logged.
|
||||
Any custom formatter MUST implement the `request` and `response` method, with one argument which
|
||||
will be passed being the Faraday environment.
|
||||
will be passed being the Faraday environment.
|
||||
If you make your formatter inheriting from `Faraday::Response::Logger::Formatter`,
|
||||
then the methods `debug`, `info`, `warn`, `error` and `fatal` are automatically delegated to the logger.
|
||||
|
||||
@ -98,7 +98,7 @@ class MyFormatter < Faraday::Logging::Formatter
|
||||
end
|
||||
|
||||
def response(env)
|
||||
# Build a custom message using `env`
|
||||
# Build a custom message using `env`
|
||||
info('Response') { 'Response Received' }
|
||||
end
|
||||
end
|
||||
@ -106,4 +106,4 @@ end
|
||||
conn = Faraday.new(url: 'http://sushi.com/api_key=s3cr3t') do |faraday|
|
||||
faraday.response :logger, nil, formatter: MyFormatter
|
||||
end
|
||||
```
|
||||
```
|
||||
|
@ -19,7 +19,7 @@ begin
|
||||
rescue Faraday::ResourceNotFound => e
|
||||
e.response[:status] #=> 404
|
||||
e.response[:headers] #=> { ... }
|
||||
e.response[:body] #=> "..."
|
||||
e.response[:body] #=> "..."
|
||||
end
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user