Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
42
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
vtechworks
Dspace7 Angular
Commits
9dbd2eec
Commit
9dbd2eec
authored
5 years ago
by
lotte
Browse files
Options
Downloads
Patches
Plain Diff
moved fix to request service
parent
57cd1772
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/core/data/request.service.ts
+13
-1
13 additions, 1 deletion
src/app/core/data/request.service.ts
src/app/core/dspace-rest-v2/dspace-rest-v2.service.ts
+4
-4
4 additions, 4 deletions
src/app/core/dspace-rest-v2/dspace-rest-v2.service.ts
with
17 additions
and
5 deletions
src/app/core/data/request.service.ts
+
13
−
1
View file @
9dbd2eec
...
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
...
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import
{
createSelector
,
MemoizedSelector
,
select
,
Store
}
from
'
@ngrx/store
'
;
import
{
createSelector
,
MemoizedSelector
,
select
,
Store
}
from
'
@ngrx/store
'
;
import
{
Observable
,
race
as
observableRace
}
from
'
rxjs
'
;
import
{
Observable
,
race
as
observableRace
}
from
'
rxjs
'
;
import
{
filter
,
mergeMap
,
take
}
from
'
rxjs/operators
'
;
import
{
filter
,
map
,
mergeMap
,
take
}
from
'
rxjs/operators
'
;
import
{
AppState
}
from
'
../../app.reducer
'
;
import
{
AppState
}
from
'
../../app.reducer
'
;
import
{
hasValue
,
isNotEmpty
}
from
'
../../shared/empty.util
'
;
import
{
hasValue
,
isNotEmpty
}
from
'
../../shared/empty.util
'
;
...
@@ -23,6 +23,8 @@ import { CommitSSBAction } from '../cache/server-sync-buffer.actions';
...
@@ -23,6 +23,8 @@ import { CommitSSBAction } from '../cache/server-sync-buffer.actions';
import
{
RestRequestMethod
}
from
'
./rest-request-method
'
;
import
{
RestRequestMethod
}
from
'
./rest-request-method
'
;
import
{
AddToIndexAction
,
RemoveFromIndexBySubstringAction
}
from
'
../index/index.actions
'
;
import
{
AddToIndexAction
,
RemoveFromIndexBySubstringAction
}
from
'
../index/index.actions
'
;
import
{
coreSelector
}
from
'
../core.selectors
'
;
import
{
coreSelector
}
from
'
../core.selectors
'
;
import
{
HttpHeaders
}
from
'
@angular/common/http
'
;
import
{
cloneDeep
}
from
'
lodash
'
;
/**
/**
* The base selector function to select the request state in the store
* The base selector function to select the request state in the store
...
@@ -118,6 +120,16 @@ export class RequestService {
...
@@ -118,6 +120,16 @@ export class RequestService {
return
this
.
store
.
pipe
(
select
(
entryFromUUIDSelector
(
originalUUID
)))
return
this
.
store
.
pipe
(
select
(
entryFromUUIDSelector
(
originalUUID
)))
},
},
))
))
).
pipe
(
map
((
entry
:
RequestEntry
)
=>
{
// Headers break after being retrieved from the store (because of lazy initialization)
// Combining them with a new object fixes this issue
if
(
hasValue
(
entry
)
&&
hasValue
(
entry
.
request
)
&&
hasValue
(
entry
.
request
.
options
)
&&
hasValue
(
entry
.
request
.
options
.
headers
))
{
entry
=
cloneDeep
(
entry
);
entry
.
request
.
options
.
headers
=
Object
.
assign
(
new
HttpHeaders
(),
entry
.
request
.
options
.
headers
)
}
return
entry
;
})
);
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/core/dspace-rest-v2/dspace-rest-v2.service.ts
+
4
−
4
View file @
9dbd2eec
...
@@ -6,7 +6,7 @@ import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/comm
...
@@ -6,7 +6,7 @@ import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/comm
import
{
DSpaceRESTV2Response
}
from
'
./dspace-rest-v2-response.model
'
;
import
{
DSpaceRESTV2Response
}
from
'
./dspace-rest-v2-response.model
'
;
import
{
HttpObserve
}
from
'
@angular/common/http/src/client
'
;
import
{
HttpObserve
}
from
'
@angular/common/http/src/client
'
;
import
{
RestRequestMethod
}
from
'
../data/rest-request-method
'
;
import
{
RestRequestMethod
}
from
'
../data/rest-request-method
'
;
import
{
isNotEmpty
}
from
'
../../shared/empty.util
'
;
import
{
hasNoValue
,
isNotEmpty
}
from
'
../../shared/empty.util
'
;
import
{
DSpaceObject
}
from
'
../shared/dspace-object.model
'
;
import
{
DSpaceObject
}
from
'
../shared/dspace-object.model
'
;
export
const
DEFAULT_CONTENT_TYPE
=
'
application/json; charset=utf-8
'
;
export
const
DEFAULT_CONTENT_TYPE
=
'
application/json; charset=utf-8
'
;
...
@@ -83,10 +83,10 @@ export class DSpaceRESTv2Service {
...
@@ -83,10 +83,10 @@ export class DSpaceRESTv2Service {
requestOptions
.
responseType
=
options
.
responseType
;
requestOptions
.
responseType
=
options
.
responseType
;
}
}
if
(
options
&&
options
.
headers
)
{
if
(
hasNoValue
(
options
)
||
hasNoValue
(
options
.
headers
))
{
requestOptions
.
headers
=
Object
.
assign
(
new
HttpHeaders
(),
options
.
headers
);
}
else
{
requestOptions
.
headers
=
new
HttpHeaders
();
requestOptions
.
headers
=
new
HttpHeaders
();
}
else
{
requestOptions
.
headers
=
options
.
headers
;
}
}
if
(
!
requestOptions
.
headers
.
has
(
'
Content-Type
'
))
{
if
(
!
requestOptions
.
headers
.
has
(
'
Content-Type
'
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment