Skip to content

Commit 8d65b5d

Browse files
committed
Changed the default onOpen validator to allow charset and boundary directives in the content-type
1 parent 506bf8d commit 8d65b5d

File tree

6 files changed

+161
-4
lines changed

6 files changed

+161
-4
lines changed

.npmignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ src/
77
.nycrc
88
jasmine.json
99
tsconfig.json
10-
*.md
10+
*.md
11+
12+
## IntellIJ files
13+
.idea
14+
*.iml

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
## 1.0.1
4+
### Changed
5+
- Changed the default onOpen validator to allow charset and boundary directives in the content-type

CONTRIBUTING.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Contributing to @microsoft/fetch-event-source
2+
3+
Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
4+
5+
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
6+
7+
8+
## Using the issue tracker
9+
10+
The [issue tracker](https://github.com/Azure/fetch-event-source/issues) is
11+
the preferred channel for [bug reports](#bugs), [features requests](#features)
12+
and [submitting pull requests](#pull-requests).
13+
14+
<a name="bugs"></a>
15+
## Bug reports
16+
17+
A bug is a _demonstrable problem_ that is caused by the code in the repository.
18+
Good bug reports are extremely helpful - thank you!
19+
20+
Guidelines for bug reports:
21+
22+
1. **Use the GitHub issue search** &mdash; check if the issue has already been
23+
reported.
24+
25+
2. **Check if the issue has been fixed** &mdash; try to reproduce it using the
26+
latest `main` or development branch in the repository.
27+
28+
3. **Isolate the problem** &mdash; ideally create a [reduced test
29+
case](https://css-tricks.com/reduced-test-cases/) and a live example.
30+
31+
A good bug report shouldn't leave others needing to chase you up for more
32+
information. Please try to be as detailed as possible in your report. What is
33+
your environment? What steps will reproduce the issue? What browser(s) and OS
34+
experience the problem? What would you expect to be the outcome? All these
35+
details will help people to fix any potential bugs.
36+
37+
Example:
38+
39+
> Short and descriptive example bug report title
40+
>
41+
> A summary of the issue and the browser/OS environment in which it occurs. If
42+
> suitable, include the steps required to reproduce the bug.
43+
>
44+
> 1. This is the first step
45+
> 2. This is the second step
46+
> 3. Further steps, etc.
47+
>
48+
> `<url>` - a link to the reduced test case
49+
>
50+
> Any other information you want to share that is relevant to the issue being
51+
> reported. This might include the lines of code that you have identified as
52+
> causing the bug, and potential solutions (and your opinions on their
53+
> merits).
54+
55+
56+
<a name="features"></a>
57+
## Feature requests
58+
59+
Feature requests are welcome. But take a moment to find out whether your idea
60+
fits with the scope and aims of the project. It's up to *you* to make a strong
61+
case to convince the project's developers of the merits of this feature. Please
62+
provide as much detail and context as possible.
63+
64+
65+
<a name="pull-requests"></a>
66+
## Pull requests
67+
68+
Good pull requests - patches, improvements, new features - are a fantastic
69+
help. They should remain focused in scope and avoid containing unrelated
70+
commits.
71+
72+
**Please ask first** before embarking on any significant pull request (e.g.
73+
implementing features, refactoring code, porting to a different language),
74+
otherwise you risk spending a lot of time working on something that the
75+
project's developers might not want to merge into the project.
76+
77+
Please adhere to the coding conventions used throughout a project (indentation,
78+
accurate comments, etc.) and any other requirements (such as test coverage).
79+
80+
Adhering to the following process is the best way to get your work
81+
included in the project:
82+
83+
1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your
84+
fork, and configure the remotes:
85+
86+
```bash
87+
# Clone your fork of the repo into the current directory
88+
git clone https://github.com/<your-username>/fetch-event-source.git
89+
# Navigate to the newly cloned directory
90+
cd fetch-event-source
91+
# Assign the original repo to a remote called "upstream"
92+
git remote add upstream https://github.com/Azure/fetch-event-source.git
93+
```
94+
95+
2. If you cloned a while ago, get the latest changes from upstream:
96+
97+
```bash
98+
git checkout main
99+
git pull upstream main
100+
```
101+
102+
3. Create a new topic branch (off the main project development branch) to
103+
contain your feature, change, or fix:
104+
105+
```bash
106+
git checkout -b <topic-branch-name>
107+
```
108+
109+
4. Locally merge (or rebase) the upstream development branch into your topic branch:
110+
111+
```bash
112+
git pull [--rebase] upstream main
113+
```
114+
115+
5. Push your topic branch up to your fork:
116+
117+
```bash
118+
git push origin <topic-branch-name>
119+
```
120+
121+
6. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
122+
with a clear title and description. As part of your PR, also:
123+
124+
a. Update the version in package.json, **but do not publish it yet**: wait till the PR has been reviewed. If you need a version published before this, you can use prerelease tags: set the package version to something like `6.0.0-prerelease.7` and run `npm publish . --tag prerelease`.
125+
126+
127+
b. Update the [changelog](CHANGELOG.md) with your changes.
128+
129+
### Cutting a release
130+
131+
Once the PR has been reviewed, follow these steps to cut a release:
132+
133+
1. [Squash and merge](https://help.github.com/articles/about-pull-request-merges/#squash-and-merge-your-pull-request-commits) your PR. Copy the PR description into the commit text.
134+
135+
2. Once the PR has been merged, tag the merge commit with the version:
136+
137+
a. `git checkout main && git pull origin main`
138+
139+
b. `git tag v<packageVersion>` (e.g., `git tag v6.0.0`)
140+
141+
c. `git push origin v<packageVersion>`
142+
143+
3. [Create a new github release](https://github.com/Azure/iot-ux-fluent-controls/releases/new) on the new tag. Use the tag name as the release title and the copy the changelog into the description.
144+
145+
146+
**IMPORTANT**: By submitting a patch, you agree to allow the project
147+
owners to license your work under the terms of the [MIT License](LICENSE.txt).
148+

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/fetch-event-source",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "A better API for making Event Source requests, with all the features of fetch()",
55
"homepage": "https://github.com/Azure/fetch-event-source#readme",
66
"bugs": {

src/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function fetchEventSource(input: RequestInfo, {
155155

156156
function defaultOnOpen(response: Response) {
157157
const contentType = response.headers.get('content-type');
158-
if (contentType !== EventStreamContentType) {
158+
if (!contentType?.startsWith(EventStreamContentType)) {
159159
throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${contentType}`);
160160
}
161161
}

0 commit comments

Comments
 (0)